summaryrefslogtreecommitdiff
path: root/cpan/Time-Local
diff options
context:
space:
mode:
authorDave Rolsky <autarch@urth.org>2012-07-20 11:28:07 -0500
committerDave Rolsky <autarch@urth.org>2012-07-24 09:08:23 -0500
commit2e37ca1eef9874492f0bc5157e8b18d05861aef6 (patch)
treeac64ad6efc2e2d2d6be879221f90197a6cd999b4 /cpan/Time-Local
parentbbe42f07d969063aabc8ae4605c000d8a83105fd (diff)
downloadperl-2e37ca1eef9874492f0bc5157e8b18d05861aef6.tar.gz
Update core to Time::Local 1.2300 from CPAN
Diffstat (limited to 'cpan/Time-Local')
-rw-r--r--cpan/Time-Local/lib/Time/Local.pm16
-rw-r--r--cpan/Time-Local/t/Local.t20
2 files changed, 17 insertions, 19 deletions
diff --git a/cpan/Time-Local/lib/Time/Local.pm b/cpan/Time-Local/lib/Time/Local.pm
index 0e9c4ac467..ecdedef3dd 100644
--- a/cpan/Time-Local/lib/Time/Local.pm
+++ b/cpan/Time-Local/lib/Time/Local.pm
@@ -6,7 +6,7 @@ use Config;
use strict;
use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK );
-$VERSION = '1.2000';
+$VERSION = '1.2300';
@ISA = qw( Exporter );
@EXPORT = qw( timegm timelocal );
@@ -109,14 +109,14 @@ sub timegm {
if $month > 11
or $month < 0;
- my $md = $MonthDays[$month];
+ my $md = $MonthDays[$month];
++$md
if $month == 1 && _is_leap_year( $year + 1900 );
croak "Day '$mday' out of range 1..$md" if $mday > $md or $mday < 1;
croak "Hour '$hour' out of range 0..23" if $hour > 23 or $hour < 0;
croak "Minute '$min' out of range 0..59" if $min > 59 or $min < 0;
- croak "Second '$sec' out of range 0..59" if $sec > 59 or $sec < 0;
+ croak "Second '$sec' out of range 0..59" if $sec >= 60 or $sec < 0;
}
my $days = _daygm( undef, undef, undef, $mday, $month, $year );
@@ -125,10 +125,10 @@ sub timegm {
my $msg = '';
$msg .= "Day too big - $days > $MaxDay\n" if $days > $MaxDay;
- $year += 1900;
+ $year += 1900;
$msg .= "Cannot handle date ($sec, $min, $hour, $mday, $month, $year)";
- croak $msg;
+ croak $msg;
}
return $sec
@@ -201,8 +201,8 @@ Time::Local - efficiently compute time from local and GMT time
=head1 SYNOPSIS
- $time = timelocal($sec,$min,$hour,$mday,$mon,$year);
- $time = timegm($sec,$min,$hour,$mday,$mon,$year);
+ $time = timelocal( $sec, $min, $hour, $mday, $mon, $year );
+ $time = timegm( $sec, $min, $hour, $mday, $mon, $year );
=head1 DESCRIPTION
@@ -239,7 +239,7 @@ C<timegm_nocheck()>. These variants must be explicitly imported.
use Time::Local 'timelocal_nocheck';
# The 365th day of 1999
- print scalar localtime timelocal_nocheck 0,0,0,365,0,99;
+ print scalar localtime timelocal_nocheck( 0, 0, 0, 365, 0, 99 );
If you supply data which is not valid (month 27, second 1,000) the
results will be unpredictable (so don't do that).
diff --git a/cpan/Time-Local/t/Local.t b/cpan/Time-Local/t/Local.t
index 521cac0bb3..472e71a2df 100644
--- a/cpan/Time-Local/t/Local.t
+++ b/cpan/Time-Local/t/Local.t
@@ -1,9 +1,10 @@
#!./perl
use strict;
+use warnings;
use Config;
-use Test::More;
+use Test::More 0.88;
use Time::Local;
# Set up time values to test
@@ -24,6 +25,9 @@ my @time =
# so it is commented out. The end of the Epoch for a 32-bit signed
# implementation of time_t should be Jan 19, 2038 03:14:07 UTC.
# [2038, 1, 17, 23, 59, 59], # last full day in any tz
+
+ [2010, 10, 12, 14, 13, 12.1],
+ [2010, 10, 12, 14, 13, 59.1],
);
# more than 2**31 time_t - requires a 64bit safe localtime/gmtime
@@ -74,14 +78,6 @@ if ($^O eq 'VMS') {
my $epoch_is_64 = eval { $Config{ivsize} == 8 && ( gmtime 2**40 )[5] == 34912 };
-my $tests = (@time * 12);
-$tests += @neg_time * 12;
-$tests += @bad_time;
-$tests += @years;
-$tests += 21;
-
-plan tests => $tests;
-
for (@time, @neg_time) {
my($year, $mon, $mday, $hour, $min, $sec) = @$_;
$year -= 1900;
@@ -100,7 +96,7 @@ for (@time, @neg_time) {
my($s,$m,$h,$D,$M,$Y) = localtime($time);
- is($s, $sec, "timelocal second for @$_");
+ is($s, int($sec), "timelocal second for @$_");
is($m, $min, "timelocal minute for @$_");
is($h, $hour, "timelocal hour for @$_");
is($D, $mday, "timelocal day for @$_");
@@ -116,7 +112,7 @@ for (@time, @neg_time) {
my($s,$m,$h,$D,$M,$Y) = gmtime($time);
- is($s, $sec, "timegm second for @$_");
+ is($s, int($sec), "timegm second for @$_");
is($m, $min, "timegm minute for @$_");
is($h, $hour, "timegm hour for @$_");
is($D, $mday, "timegm day for @$_");
@@ -265,3 +261,5 @@ SKIP:
is( ( localtime( timelocal( 0, 0, 2, 27, 2, 2005 ) ) )[2], 2,
'hour is 2 when given 2:00 AM on Europe/London date change' );
}
+
+done_testing();