我得到了 2009 年 2 月 28日的纪元时间,然后加上一周的秒数。但是后来我得到了 March 4 th而不是 March 7 th。为什么?
以下是代码:
#!/usr/bin/perl
use POSIX;
my $hours_per_day = 24;
my $hours_per_week = 168;
my $seconds_per_hour = 3600;
my $seconds_per_week = ($hours_per_week * $seconds_per_hour);
#begin at my first week
$epoch_seconds = POSIX::mktime(0,0,12,28,2,109);
for(my $cline = 1; $cline <= 250; $cline++) {
($sec,$min,$hour,$mday,$month,
$year,$wday,$yday,$isdst) = localtime($epoch_seconds);
$year += 1900;
print STDOUT "$cline <=> $year/$month/$mday\n";
$epoch_seconds += $seconds_per_week;
}