package Time::Local;
-use 5.006;
+
require Exporter;
use Carp;
use Config;
use strict;
use integer;
-our $VERSION = '1.04';
-our @ISA = qw( Exporter );
-our @EXPORT = qw( timegm timelocal );
-our @EXPORT_OK = qw( timegm_nocheck timelocal_nocheck );
+use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK );
+$VERSION = '1.06';
+@ISA = qw( Exporter );
+@EXPORT = qw( timegm timelocal );
+@EXPORT_OK = qw( timegm_nocheck timelocal_nocheck );
my @MonthDays = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
These routines are the inverse of built-in perl functions localtime()
and gmtime(). They accept a date as a six-element array, and return
-the corresponding time(2) value in seconds since the Epoch (Midnight,
-January 1, 1970). This value can be positive or negative.
+the corresponding time(2) value in seconds since the system epoch
+(Midnight, January 1, 1970 UTC on Unix, for example). This value can
+be positive or negative, though POSIX only requires support for
+positive values, so dates before the system's epoch may not work on
+all operating systems.
It is worth drawing particular attention to the expected ranges for
the values provided. The value for the day of the month is the actual day
The proclivity to croak() is probably a bug.
+=head1 SUPPORT
+
+Support for this module is provided via the perl5-porters@perl.org
+email list. See http://lists.perl.org/ for more details.
+
+Please submit bugs using the RT system at bugs.perl.org, the perlbug
+script, or as a last resort, to the perl5-porters@perl.org list.
+
+=head1 AUTHOR
+
+This module is based on a Perl 4 library, timelocal.pl, that was
+included with Perl 4.036, and was most likely written by Tom
+Christiansen.
+
+The current version was written by Graham Barr.
+
+It is now being maintained separately from the Perl core by Dave
+Rolsky, <autarch@urth.org>.
+
=cut
#!./perl
BEGIN {
- chdir 't' if -d 't';
- @INC = '../lib';
+ if ($ENV{PERL_CORE}){
+ chdir('t') if -d 't';
+ @INC = ('.', '../lib');
+ }
}
use Time::Local;
# use vmsish 'time' makes for oddness around the Unix epoch
if ($^O eq 'VMS') { $time[0][2]++ }
-print "1..", @time * 2 + 6, "\n";
+my $tests = @time * 2 + 4;
+$tests += 2 if $ENV{PERL_CORE};
+
+print "1..$tests\n";
$count = 1;
for (@time) {
# 03:00:00. In this case, 02:00:00 is an invalid time, and should be
# treated like 03:00:00 rather than 01:00:00 - negative zone offsets used
# to do the latter
-
{
my $hour = (localtime(timelocal(0, 0, 2, 7, 3, 102)))[2];
# testers in US/Pacific should get 3,
print "ok ", $main::count++, "\n";
}
+if ($ENV{PERL_CORE}) {
+ #print "Testing timelocal.pl module too...\n";
+ package test;
+ require 'timelocal.pl';
+ timegm(0,0,0,1,0,80) == main::timegm(0,0,0,1,0,80) or print "not ";
+ print "ok ", $main::count++, "\n";
-#print "Testing timelocal.pl module too...\n";
-package test;
-require 'timelocal.pl';
-timegm(0,0,0,1,0,80) == main::timegm(0,0,0,1,0,80) or print "not ";
-print "ok ", $main::count++, "\n";
-
-timelocal(1,2,3,4,5,88) == main::timelocal(1,2,3,4,5,88) or print "not ";
-print "ok ", $main::count++, "\n";
+ timelocal(1,2,3,4,5,88) == main::timelocal(1,2,3,4,5,88) or print "not ";
+ print "ok ", $main::count++, "\n";
+}