From: Rafael Garcia-Suarez Date: Fri, 6 Jun 2003 23:00:00 +0000 (+0000) Subject: Upgrade to Time::Local 1.06, by Dave Rolsky X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1c41b6a40e5aeac1093e663897894b8c7836dbbb;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Time::Local 1.06, by Dave Rolsky p4raw-id: //depot/perl@19702 --- diff --git a/lib/Time/Local.pm b/lib/Time/Local.pm index 51553b5..a072c74 100644 --- a/lib/Time/Local.pm +++ b/lib/Time/Local.pm @@ -1,15 +1,16 @@ 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); @@ -169,8 +170,11 @@ Time::Local - efficiently compute time from local and GMT time 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 @@ -262,5 +266,24 @@ The whole scheme for interpreting two-digit years can be considered a bug. 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, . + =cut diff --git a/lib/Time/Local.t b/lib/Time/Local.t index 68952c9..809dd92 100755 --- a/lib/Time/Local.t +++ b/lib/Time/Local.t @@ -1,8 +1,10 @@ #!./perl BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; + if ($ENV{PERL_CORE}){ + chdir('t') if -d 't'; + @INC = ('.', '../lib'); + } } use Time::Local; @@ -28,7 +30,10 @@ 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) { @@ -98,7 +103,6 @@ print "ok ", $count++, "\n"; # 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, @@ -107,12 +111,13 @@ print "ok ", $count++, "\n"; 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"; +}