From: Michael G Schwern Date: Sun, 14 Sep 2008 02:40:58 +0000 (-0700) Subject: Write down the logic behind the localtime vs gmtime date ranges. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9b3ca67b76fa79ecb7d074f90d239dfb4b1a916d;p=p5sagit%2Fp5-mst-13.2.git Write down the logic behind the localtime vs gmtime date ranges. --- diff --git a/lib/Time/gmtime.t b/lib/Time/gmtime.t index 0e3855c..383eeda 100644 --- a/lib/Time/gmtime.t +++ b/lib/Time/gmtime.t @@ -11,7 +11,8 @@ BEGIN { plan tests => 37; } BEGIN { use_ok Time::gmtime; } -for my $time (0, 2**31-1, 2**33, time) { +# Perl has its own gmtime() so it's safe to do negative times. +for my $time (-2**33, -2**31-1, 0, 2**31-1, 2**33, time) { my $gmtime = gmtime $time; # This is the OO gmtime. my @gmtime = CORE::gmtime $time; # This is the gmtime function diff --git a/lib/Time/localtime.t b/lib/Time/localtime.t index 5d935e7..10df765 100644 --- a/lib/Time/localtime.t +++ b/lib/Time/localtime.t @@ -25,6 +25,8 @@ BEGIN { plan tests => 37; } BEGIN { use_ok Time::localtime; } +# Since Perl's localtime() still uses the system localtime, don't try +# to do negative times. The system might not support it. for my $time (0, 2**31-1, 2**33, time) { my $localtime = localtime $time; # This is the OO localtime. my @localtime = CORE::localtime $time; # This is the localtime function