Skip Menu |
 

This queue is for tickets about the Time-ParseDate CPAN distribution.

Report information
The Basics
Id: 96453
Status: resolved
Priority: 0/
Queue: Time-ParseDate

People
Owner: Nobody in particular
Requestors: riqyroe [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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>
Download (untitled) / with headers
text/plain 1.2k
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
John Karr handle the fix. Thanks!


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.