All the Perl that's Practical to Extract and Report

Navigation

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Without JavaScript enabled, you might want to
use the classic discussion system instead. If you login, you can remember this preference.

Please Log In to Continue

You might not have noticed the big section in the change log labelled "BACKWARDS INCOMPATIBILITIES". And this change occurred back in 0.17. Unfortunately, the previous behavior when subtracting one datetime from another was broken. It _claimed_ to be returning the absolute difference between two datetimes, but it wasn't, because days are of varying lengths. In fact, the absolute difference between two datetimes can only be expressed in seconds + nanoseconds.

The problem is that I'm not interested in the number of seconds, but the actual days. I understand that in some cases days are slightly longer/shorter, but in terms of actual days, how long a day is immaterial for my uses.

It has been really annoying because it now means if anyone updates DateTime and is using my module, or any other module that relies on delta_days(), the code now breaks disastrously. It would have been better to leave the function as is, and create another function along the lines of delta_days_accurate(). Then document the reason why not to use delta_days() if you require an exact calculation.

My quick fix is to now disable the use of DateTime if after version 0.16. That's not something I like to do, but I don't have time to add in all the code that I'll need to do the calculation myself.

I didn't notice the "BACKWARDS INCOMPATIBILITIES" section, because I've been using 0.13. It's only because all the test reports were coming back with bizarre errors that I took the time to shoehorn v0.18 into installing (the infinity thing is a bit of bugger!).