Skip Menu |
Report information
Id: 1305
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: allen [at] grumman.com
Cc:
AdminCc:

Operating System: generic
PatchStatus: (no value)
Severity: medium
Type: core
Perl Version: (no value)
Fixed In: (no value)



Date: Wed, 1 Sep 1999 13:33:39 -0400 (EDT)
From: "John L. Allen" <allen [...] grumman.com>
To: perlbug [...] perl.org
Subject: Time::Local should not croak on "out-of-range" days
$ perl -MTime::Local -e 'print scalar localtime timelocal 0,0,0,280,0,99' Day '280' out of range 1..31 at -e line 1 It is quite convenient to be able to use timelocal to convert from "julian" YYDDD format to others. The warning serves no purpose anyway, since the following is not caught $ perl -MTime::Local -e 'print scalar localtime timelocal 0,0,0,31,2,99' Wed Mar 31 00:00:00 1999 Ie, there is no 31st day in February. Appended is the trivial patch against _60 in case the pumpking agrees with me. John. $ diff -c Local.pm.orig Local.pm *** Local.pm.orig Tue Jul 20 13:18:01 1999 --- Local.pm Wed Sep 1 13:28:49 1999 *************** *** 74,80 **** $year = $_[5]; $month = $_[4]; croak "Month '$month' out of range 0..11" if $month > 11 || $month < 0; - croak "Day '$_[3]' out of range 1..31" if $_[3] > 31 || $_[3] < 1; croak "Hour '$_[2]' out of range 0..23" if $_[2] > 23 || $_[2] < 0; croak "Minute '$_[1]' out of range 0..59" if $_[1] > 59 || $_[1] < 0; croak "Second '$_[0]' out of range 0..59" if $_[0] > 59 || $_[0] < 0; --- 74,79 ----
Date: Wed, 1 Sep 1999 13:46:01 -0400 (EDT)
From: "John L. Allen" <allen [...] grumman.com>
To: perl5-porters [...] perl.org
Subject: Re: [ID 19990901.003] Time::Local should not croak on "out-of-range" days
Download (untitled) / with headers
text/plain 484b
On Wed, 1 Sep 1999, I, John L. Allen wrote: Show quoted text
> The warning serves no purpose anyway, since the following is not caught > > $ perl -MTime::Local -e 'print scalar localtime timelocal 0,0,0,31,2,99'
^ should be 1 Show quoted text
> Wed Mar 31 00:00:00 1999
And this should have been Wed Mar 3 00:00:00 1999 Show quoted text
> > Ie, there is no 31st day in February.
John.
Date: Wed, 1 Sep 1999 15:40:15 -0500
From: duff [...] cbi.tamucc.edu
To: "John L. Allen" <allen [...] grumman.com>
Cc: perl5-porters [...] perl.org
Subject: Re: [ID 19990901.003] Time::Local should not croak on "out-of-range" days
Download (untitled) / with headers
text/plain 1.1k
On Wed, Sep 01, 1999 at 01:33:39PM -0400, John L. Allen wrote: Show quoted text
> > Can we please get rid of the useless day range check in Time::Local? > Pleeease? I recall this being argued before.
Indeed, I argued it before. But I proposed something slightly more radical: get rid of *all* range checking. Checking the range of each arguement is orthogonal to calculating a GMT and should be a separate routine. BTW, didn't Mike Stok or someone have an alternate Time::Local implementation that was less buggy than the current implementation? Show quoted text
> > $ perl -MTime::Local -e 'print scalar localtime timelocal 0,0,0,280,0,99' > Day '280' out of range 1..31 at -e line 1 > > It is quite convenient to be able to use timelocal to convert from "julian" > YYDDD format to others.
Yep, that's what I use it for. Show quoted text
> The warning serves no purpose anyway, since the following is not caught > > $ perl -MTime::Local -e 'print scalar localtime timelocal 0,0,0,31,2,99' > Wed Mar 31 00:00:00 1999
you mean perl -MTime::Local -e 'print scalar localtime timelocal 0,0,0,31,1,99' (February is month number 1) -Scott -- Jonathan Scott Duff duff@cbi.tamucc.edu


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org