Subject: | 0 is a valid epoch seconds value |
Date: | Sat, 14 Jun 2014 12:45:32 -0700 |
To: | bug-Time-ParseDate [...] rt.cpan.org |
From: | Richard phuQin' Roe <riqyroe [...] yahoo.com> |
In the Time::Timezone module, in the tz_local_offset subroutine, U change $time to be the current time `unless $time` which keeps us from being able to correctly parse the exact beginning of the epoch during DST. It should be `unless defined $time`.
So, for example in my timezone (MST7MDT):
parsedate("Wed Dec 31 16:59:59 1969") = -1 ; scalar localtime = Wed Dec 31 16:59:59 1969
parsedate("Wed Dec 31 17:00:00 1969") = -3600 ; scalar localtime = Wed Dec 31 16:00:00 1969
parsedate("Wed Dec 31 17:00:01 1969") = 1 ; scalar localtime = Wed Dec 31 17:00:01 1969
Note how the middle one is very wrong. Testing for defined fixes the issue. There are plenty of other places where U do the same thing, U should probably fix them all.
Just a friendly tip from one perl developer to another: always be specific in your checks. Since 0, '0', '', undef, and objects which overload 'bool' can all return false in boolean context make sure to test for the one you're actually looking for. :-) There are many scenarios in which false-ish is good enough, but many--like this one--in which it is not.
Of course, the problem would not have cropped up if my area just got rid of DST and TZ differences were the same year round; we probably can't rely on that though. ;-)
ThanX