Time::Local::timelocal() is broken over GMT/BST change

Bug #96018 reported by Crispin Flowerday
2
Affects Status Importance Assigned to Milestone
libtime-local-perl (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: perl

The Time::Local::timelocal() function seems to be broken today after the GMT -> BST daylight saving time change in the UK, e.g:

$ date
Sun Mar 25 18:28:21 BST 2007
$ perl -MTime::Local -e 'print scalar localtime( timelocal( localtime() ) ) . "\n";'
Sun Mar 25 19:28:48 2007

Notice that going through timelocal() causes the hour to be offset by one hour, the above operation should be a no-op and print out the current local time (and indeed tomorrow it will work fine).

Another example:

use Time::Local;
@a = ( 0, 43, 5, 25, 2, 107 ); # 5:43am, 25th March 2007
$t = timelocal( @a ) ;
print scalar localtime( $t ), "\n"; # Prints 6:43am

@a = ( 0, 43, 5, 26, 2, 107 ); # 5:43am, 26th March 2007
$t = timelocal( @a ) ;
print scalar localtime( $t ), "\n"; # Prints 5:43am

This broken behaviour seems to be isolated to timezones that changed from GMT (e.g. Europe/London, Europe/Dublin, Europe/Isle_of_Man all show the problem, but Europe/Paris and Europe/Berlin don't).

I have reproduced this on both edgy and feisty. FWIW, Using Time::Local version 1.07 works, but 1.10 doesn't (I don't have 1.08 or 1.09 available to test).

ProblemType: Bug
Architecture: i386
Date: Sun Mar 25 18:26:31 2007
DistroRelease: Ubuntu 7.04
Uname: Linux moonraker 2.6.20-12-generic #2 SMP Wed Mar 21 20:55:46 UTC 2007 i686 GNU/Linux

Revision history for this message
Steve Peters (steve-fisharerojo) wrote : Re: [Bug 96018] Time::Local::timelocal() is broken over GMT/BST change

On Sun, Mar 25, 2007 at 05:43:34PM -0000, Crispin Flowerday wrote:
> Public bug reported:
>
> Binary package hint: perl
>
> The Time::Local::timelocal() function seems to be broken today after the
> GMT -> BST daylight saving time change in the UK, e.g:
>
> $ date
> Sun Mar 25 18:28:21 BST 2007
> $ perl -MTime::Local -e 'print scalar localtime( timelocal( localtime() ) ) . "\n";'
> Sun Mar 25 19:28:48 2007
>
> Notice that going through timelocal() causes the hour to be offset by
> one hour, the above operation should be a no-op and print out the
> current local time (and indeed tomorrow it will work fine).
>
> Another example:
>
> use Time::Local;
> @a = ( 0, 43, 5, 25, 2, 107 ); # 5:43am, 25th March 2007
> $t = timelocal( @a ) ;
> print scalar localtime( $t ), "\n"; # Prints 6:43am
>
> @a = ( 0, 43, 5, 26, 2, 107 ); # 5:43am, 26th March 2007
> $t = timelocal( @a ) ;
> print scalar localtime( $t ), "\n"; # Prints 5:43am
>
>
> This broken behaviour seems to be isolated to timezones that changed from GMT (e.g. Europe/London, Europe/Dublin, Europe/Isle_of_Man all show the problem, but Europe/Paris and Europe/Berlin don't).
>
> I have reproduced this on both edgy and feisty. FWIW, Using Time::Local
> version 1.07 works, but 1.10 doesn't (I don't have 1.08 or 1.09
> available to test).
>

The most recent version of Time::Local on CPAN is 1.17. Perhaps using that
will cause the problems to go away. It appears that the problem was fixed
by 1.13.

1.13 2006-08-09

- Switched to using Test::More for the tests.

- Fixed a bug that occurred around the DST change for Europe/London
  (and probably other time zones with a positive UTC offset). If
  given, the hour immediately after the change (2:00 AM for
  Europe/London), then the returned epoch was 3600 seconds too
  large. Reported by Roger Picton. See RT #11662.

Steve Peters
<email address hidden>

Revision history for this message
Crispin Flowerday (crispin-flowerday-deactivatedaccount) wrote :

This is still broken in Hardy (Time::Local version 1.11) however downloading version 1.17 from CPAN fixes the problem.

Revision history for this message
Simon Morgan (sjmorgan) wrote :

Time::Local 1.18 is in Ubuntu 8.10 and appears to resolve this issue as per your test cases.

Changed in perl:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.