I noticed that the UNIX time from timelocal() started to differ from that
you get from using DateTime module, for dates earlier than 11/6/1910.
 
For the America/New_York local timezone, timelocal() thinks there was a DST
switch on 11/6/1910, while DateTime module thinks there was none.
 
If you run the attached script (after setting your host TZ env to New York)
twice (with Perl 5.24), you will see these outputs:
 
F:\ABT\Dev\PerlUtil>perl David.pl 1910 11 06 08 00 00
Epoch for 19101106:080000 (UTC) =       -1866729600     based on Epoch().
Epoch for 19101106:080000 (UTC) =       -1866729600     based on timegm().
Epoch for 19101106:080000 (NYC) =       -1866711600     based on Epoch().
Epoch for 19101106:080000 (NYC) =       -1866711600     based on
timelocal().
 
F:\ABT\Dev\PerlUtil>perl David.pl 1910 11 05 08 00 00
Epoch for 19101105:080000 (UTC) =       -1866816000     based on Epoch().
Epoch for 19101105:080000 (UTC) =       -1866816000     based on timegm().
Epoch for 19101105:080000 (NYC) =       -1866798000     based on Epoch().
Epoch for 19101105:080000 (NYC) =       -1866801600     based on
timelocal().
 
So it seems either DateTime or timelocal() has a bug regarding the DST
switch over on 11/6/1910.  Am I missing something?
 
Regards,
Lu Feng

Attachment: David.pl
Description: Binary data



Reply via email to