This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Time::Local 1.12
[perl5.git] / lib / Time / Local.t
index b2c1215..eb48432 100755 (executable)
@@ -53,10 +53,13 @@ my @neg_time =
      [ 1950, 04, 12, 9, 30, 31 ],
     );
 
      [ 1950, 04, 12, 9, 30, 31 ],
     );
 
-my $neg_epoch_ok = defined ((localtime(-3600))[0]) ? 1 : 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
 
 # use vmsish 'time' makes for oddness around the Unix epoch
-if ($^O eq 'VMS') { 
+if ($^O eq 'VMS') {
     $time[0][2]++;
     $neg_epoch_ok = 0; # time_t is unsigned
 }
     $time[0][2]++;
     $neg_epoch_ok = 0; # time_t is unsigned
 }
@@ -66,7 +69,7 @@ $tests += @neg_time * 12;
 $tests += @bad_time;
 $tests += 8;
 $tests += 2 if $ENV{PERL_CORE};
 $tests += @bad_time;
 $tests += 8;
 $tests += 2 if $ENV{PERL_CORE};
-$tests += 5 if $ENV{MAINTAINER};
+$tests += 6 if $ENV{MAINTAINER};
 
 plan tests => $tests;
 
 
 plan tests => $tests;
 
@@ -206,6 +209,12 @@ if ($ENV{MAINTAINER}) {
         $time = timelocal(0, 30, 2, 28, 9, 101);
         ok($time, 1004200200,
            'timelocal for non-existent time gives you the time one hour later');
         $time = timelocal(0, 30, 2, 28, 9, 101);
         ok($time, 1004200200,
            'timelocal for non-existent time gives you the time one hour later');
+
+        local $ENV{TZ} = 'Europe/London';
+        POSIX::tzset();
+        $time = timelocal( localtime(1111917720) );
+        ok($time, 1111917720,
+           'timelocal for round trip bug on date of DST change for Europe/London');
     }
 }
 
     }
 }