This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix lib/Time/Local.pm for VOS
[perl5.git] / lib / Time / Local.pm
index 126c365..a8f2e49 100644 (file)
@@ -2,10 +2,11 @@ package Time::Local;
 use 5.006;
 require Exporter;
 use Carp;
+use Config;
 use strict;
 use integer;
 
-our $VERSION    = '1.03';
+our $VERSION    = '1.04';
 our @ISA       = qw( Exporter );
 our @EXPORT    = qw( timegm timelocal );
 our @EXPORT_OK = qw( timegm_nocheck timelocal_nocheck );
@@ -22,13 +23,19 @@ my $Century      = $NextCentury - 100;
 my (%Options, %Cheat);
 
 # Determine the EPOC day for this machine
-my $Epoc = 0; $Epoc = _daygm(gmtime(0));
+my $Epoc = 0;
+if ($^O eq 'vos') {
+# work around posix-977 -- VOS doesn't handle dates in
+# the range 1970-1980.
+  $Epoc = _daygm((0, 0, 0, 1, 0, 70, 4, 0));
+} else {
+  $Epoc = _daygm(gmtime(0));
+}
+
 %Cheat=(); # clear the cache as epoc has changed
 
-my $MaxDay = do {
-  no integer;
-  int((~0>>1-43200)/86400)-1;
-};
+my $MaxInt = ((1<<(8 * $Config{intsize} - 2))-1)*2 + 1;
+my $MaxDay = int(($MaxInt-43200)/86400)-1;
 
 
 sub _daygm {