Subject: | month >= 12 doesn't add to year with _nocheck |
The problem was discovered in 1.04, but I believe it still exists in 1.11.
Test:
use Time::Local qw/timelocal_nocheck/;
print scalar( localtime( timelocal_nocheck( 0,0,0,1,0,5 )) ), "\n";
print scalar( localtime( timelocal_nocheck( 0,0,0,1,12,5 )) ), "\n";
Output:
Sat Jan 1 00:00:00 2005
Sat Jan 1 00:00:00 2005
Expected Output:
Sat Jan 1 00:00:00 2005
Sat Jan 1 00:00:00 2006
Possible patch:
=sub _daygm {
= $_[3] + ($Cheat{pack("ss",@_[4,5])} ||= do {
= my $month = ($_[4] + 10) % 12;
- my $year = $_[5] + 1900 - $month/10;
+ my $year = $_[5] + 1900 + ($_[4] + 10) / 12 - 1;
= 365*$year + $year/4 - $year/100 + $year/400 + ($month*306 + 5)/10 - $Epoc
= });
=}