Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 61227
Status: rejected
Priority: 0/
Queue: Time-Local

People
Owner: Nobody in particular
Requestors: chris [...] heathens.co.nz
Cc:
AdminCc:

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



Subject: Daylight Savings transition wrong for Europe/London
During the ambiguous period when London is switching from BST back to GMT, localtime returns the later of the two possible values, contrary to the documented behavior. Program to demonstrate: use Time::Local; $ENV{'TZ'} = ':Europe/London'; my @ambiguous_time = (0,0,1,31,9,110); # 1am on Oct 31 2010. my $timegm = timegm(@ambiguous_time); my $timelocal = $timegm - 3600; # Expected value for timelocal print "timelocal = " . timelocal(@ambiguous_time) . " (should be $timelocal)\n"; print "localtime($timegm) = " . localtime($timegm) . "\n"; print "localtime($timelocal) = " . localtime($timelocal) . "\n"; Output in 1.1901: timelocal = 1288486800 (should be 1288483200) localtime(1288486800) = Sun Oct 31 01:00:00 2010 localtime(1288483200) = Sun Oct 31 01:00:00 2010 This patch seems to fix it: --- Time-Local-1.1901/lib/Time/Local.pm.orig 2008-11-02 03:55:50.000000000 +0000 +++ Time-Local-1.1901/lib/Time/Local.pm 2010-09-10 04:31:41.000000000 +0000 @@ -149,8 +149,7 @@ my $ref_t = &timegm; my $loc_for_ref_t = _timegm( localtime($ref_t) ); - my $zone_off = $loc_for_ref_t - $ref_t - or return $loc_for_ref_t; + my $zone_off = $loc_for_ref_t - $ref_t; # Adjust for timezone my $loc_t = $ref_t - $zone_off;
I'm not really maintaining this module any more, as it's become fairly tightly tied to changes in the Perl core. You should probably submit this bug via perlbug. On Fri Sep 10 00:38:44 2010, cheath wrote: Show quoted text
> During the ambiguous period when London is switching from BST back to > GMT, localtime returns the later of the two possible values, contrary > to the documented behavior. > > Program to demonstrate: > > use Time::Local; > $ENV{'TZ'} = ':Europe/London'; > my @ambiguous_time = (0,0,1,31,9,110); # 1am on Oct 31 2010. > my $timegm = timegm(@ambiguous_time); > my $timelocal = $timegm - 3600; # Expected value for timelocal > print "timelocal = " . timelocal(@ambiguous_time) . " (should be > $timelocal)\n"; > print "localtime($timegm) = " . localtime($timegm) . "\n"; > print "localtime($timelocal) = " . localtime($timelocal) . "\n"; > > Output in 1.1901: > timelocal = 1288486800 (should be 1288483200) > localtime(1288486800) = Sun Oct 31 01:00:00 2010 > localtime(1288483200) = Sun Oct 31 01:00:00 2010 > > This patch seems to fix it: > > --- Time-Local-1.1901/lib/Time/Local.pm.orig 2008-11-02 > 03:55:50.000000000 +0000 > +++ Time-Local-1.1901/lib/Time/Local.pm 2010-09-10 > 04:31:41.000000000 +0000 > @@ -149,8 +149,7 @@ > my $ref_t = &timegm; > my $loc_for_ref_t = _timegm( localtime($ref_t) ); > > - my $zone_off = $loc_for_ref_t - $ref_t > - or return $loc_for_ref_t; > + my $zone_off = $loc_for_ref_t - $ref_t; > > # Adjust for timezone > my $loc_t = $ref_t - $zone_off;