houseabsolute / Time-Local

Efficiently compute time from local and GMT time
https://metacpan.org/release/Time-Local/
Other
4 stars 11 forks source link

Documentation example will be incorrect after 2049 #14

Closed eserte closed 4 years ago

eserte commented 4 years ago

The comment in https://metacpan.org/pod/release/DROLSKY/Time-Local-1.28/lib/Time/Local.pm#timelocal_nocheck()-and-timegm_nocheck() ("The 365th day of 1999") will only be valid until end of 2048. In 2049 it will be the 365th day of 2099.

$ perl5.31.7 -le 'use Time::Local 'timelocal_nocheck'; print scalar localtime timelocal_nocheck( 0, 0, 0, 365, 0, 99 );'
Fri Dec 31 00:00:00 1999
$ env PERL5OPT="-MTime::Fake=+29y" perl5.31.7 -le 'use Time::Local 'timelocal_nocheck'; print scalar localtime timelocal_nocheck( 0, 0, 0, 365, 0, 99 );'
Thu Dec 31 00:00:00 2099

Probably a four-digit year should be used here.

autarch commented 4 years ago

Fixed (by removing this bit of docs) in 1.30.