X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FTime%2FLocal.t;h=17e811583f2fe7c4705777c85d1b5e4fe7b1f4a7;hb=4c91ace1ab7f54d4e52467ee37e480e29b555047;hp=ef32b40405d356ee49446b90aba440db920228ba;hpb=dc164757d6434bcc04e6bf2256aab2dea31afaa0;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Time/Local.t b/lib/Time/Local.t index ef32b40..17e8115 100755 --- a/lib/Time/Local.t +++ b/lib/Time/Local.t @@ -62,17 +62,6 @@ my @years = [ 2100 => 0 ], ); -# Use 3 days before the start of the epoch because with Borland on -# Win32 it will work for -3600 _if_ your time zone is +01:00 (or -# greater). -my $neg_epoch_ok = defined ((localtime(-259200))[0]) ? 1 : 0; - -# use vmsish 'time' makes for oddness around the Unix epoch -if ($^O eq 'VMS') { - $time[0][2]++; - $neg_epoch_ok = 0; # time_t is unsigned -} - my $tests = (@time * 12); $tests += @neg_time * 12; $tests += @bad_time; @@ -88,28 +77,23 @@ for (@time, @neg_time) { $year -= 1900; $mon--; - SKIP: { - skip '1970 test on VOS fails.', 12 - if $^O eq 'vos' && $year == 70; - skip 'this platform does not support negative epochs.', 12 - if $year < 70 && ! $neg_epoch_ok; - - { - my $year_in = $year < 70 ? $year + 1900 : $year; - my $time = timelocal($sec,$min,$hour,$mday,$mon,$year_in); - - my($s,$m,$h,$D,$M,$Y) = localtime($time); - - is($s, $sec, "timelocal second for @$_"); - is($m, $min, "timelocal minute for @$_"); - is($h, $hour, "timelocal hour for @$_"); - is($D, $mday, "timelocal day for @$_"); - is($M, $mon, "timelocal month for @$_"); - is($Y, $year, "timelocal year for @$_"); - } + # Test timelocal() + { + my $year_in = $year < 70 ? $year + 1900 : $year; + my $time = timelocal($sec,$min,$hour,$mday,$mon,$year_in); + + my($s,$m,$h,$D,$M,$Y) = localtime($time); + + is($s, $sec, "timelocal second for @$_"); + is($m, $min, "timelocal minute for @$_"); + is($h, $hour, "timelocal hour for @$_"); + is($D, $mday, "timelocal day for @$_"); + is($M, $mon, "timelocal month for @$_"); + is($Y, $year, "timelocal year for @$_"); } - # Perl has its own gmtime() + + # Test timegm() { my $year_in = $year < 70 ? $year + 1900 : $year; my $time = timegm($sec,$min,$hour,$mday,$mon,$year_in); @@ -125,6 +109,7 @@ for (@time, @neg_time) { } } + for (@bad_time) { my($year, $mon, $mday, $hour, $min, $sec) = @$_; $year -= 1900;