summaryrefslogtreecommitdiff
path: root/lib/Time
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-05-28 13:18:56 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-05-28 13:18:56 +0000
commiteee3200793bb3b1cb7b4101c338de67e73b8e4d1 (patch)
tree9fd1ddd9269af31b577e48001a6cc1f9a979a427 /lib/Time
parent737e87b07f62e6b8f30278331684c3f57ce8be3c (diff)
downloadperl-eee3200793bb3b1cb7b4101c338de67e73b8e4d1.tar.gz
Re: [ID 20010522.003] Time::Local module bug
From: "Stephen P. Potter" <spp@spotter.yi.org> Date: Tue, 22 May 2001 11:40:25 -0400 Message-Id: <20010522154030.584F4729E2@belgarath.spotter.yi.org> Subject: Re: [ID 20010522.003] Time::Local module bug From: Ronald J Kimball <rjk@linguist.Thayer.dartmouth.edu> Date: Tue, 22 May 2001 11:50:19 -0400 Message-ID: <20010522115019.D48634@linguist.thayer.dartmouth.edu> p4raw-id: //depot/perl@10241
Diffstat (limited to 'lib/Time')
-rw-r--r--lib/Time/Local.pm18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Time/Local.pm b/lib/Time/Local.pm
index 9c81209ad3..35d74ab93b 100644
--- a/lib/Time/Local.pm
+++ b/lib/Time/Local.pm
@@ -4,7 +4,7 @@ require Exporter;
use Carp;
use strict;
-our $VERSION = '1.00';
+our $VERSION = '1.01';
our @ISA = qw( Exporter );
our @EXPORT = qw( timegm timelocal );
our @EXPORT_OK = qw( timegm_nocheck timelocal_nocheck );
@@ -87,12 +87,14 @@ sub timelocal_nocheck {
sub cheat {
my($ym, @date) = @_;
my($sec, $min, $hour, $day, $month, $year) = @date;
+ my($md);
unless ($Options{no_range_check}) {
- croak "Month '$month' out of range 0..11" if $month > 11 || $month < 0;
- croak "Day '$day' out of range 1..31" if $day > 31 || $day < 1;
- croak "Hour '$hour' out of range 0..23" if $hour > 23 || $hour < 0;
- croak "Minute '$min' out of range 0..59" if $min > 59 || $min < 0;
- croak "Second '$sec' out of range 0..59" if $sec > 59 || $sec < 0;
+ croak "Month '$month' out of range 0..11" if $month > 11 || $month < 0;
+ $md = (31, 29, 31, 30, 31, 30, 31, 30, 30, 31, 30, 31)[$month];
+ croak "Day '$day' out of range 1..$md" if $day > $md || $day < 1;
+ croak "Hour '$hour' out of range 0..23" if $hour > 23 || $hour < 0;
+ croak "Minute '$min' out of range 0..59" if $min > 59 || $min < 0;
+ croak "Second '$sec' out of range 0..59" if $sec > 59 || $sec < 0;
}
my $guess = $^T;
my @g = gmtime($guess);
@@ -151,8 +153,8 @@ the corresponding time(2) value in seconds since the Epoch (Midnight,
January 1, 1970). This value can be positive or negative.
It is worth drawing particular attention to the expected ranges for
-the values provided. While the day of the month is expected to be in
-the range 1..31, the month should be in the range 0..11.
+the values provided. The value for the day of the month is the actual day
+(ie 1..31), while the month is the number of months since January (0..11).
This is consistent with the values returned from localtime() and gmtime().
The timelocal() and timegm() functions perform range checking on the