Subject: | Date::Parse bug |
Date: | Mon, 24 May 2010 12:57:10 -0400 |
To: | <bug-TimeDate [...] rt.cpan.org> |
From: | "SCHMALZRIED, TERRY (ATTLABS)" <ts862m [...] att.com> |
Found a date that str2time() in TimeDate-1.20 > Date::Parse is not
parsing correctly (but that strptime() does parse correctly). Output,
code, and environment below:
$ bad.pl
str2time:
Day too big - 32993 > 24854
Sec too small - 32993 < 74752
str2time returned undef upon failure to parse '5/1/1960'
strptime:
strptime returned ',,,1,4,60,' from parsing '5/1/1960'
$ cat bad.pl
#!/usr/bin/perl
use Date::Parse;
$date = "5/1/1960";
print "\nstr2time:\n";
$val = str2time($date);
if (!defined($val)) { print STDERR "str2time returned undef upon failure
to parse '$date'\n"; }
print "\nstrptime:\n";
@parts = strptime($date);
if ($#parts < 0) { print STDERR "strptime returned empty array upon
failure to parse '$date'\n"; }
else {
($ss,$mm,$hh,$day,$month,$year,$zone) = @parts;
print "strptime returned '$ss,$mm,$hh,$day,$month,$year,$zone' from
parsing '$date'\n";
}
$ /usr/bin/perl -v
This is perl, v5.8.8 built for i386-linux-thread-multi
Copyright 1987-2006, Larry Wall
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to
the
Internet, point your browser at http://www.perl.org/, the Perl Home
Page.
$ uname -a
Linux mtndbic01 2.6.18-128.el5 #1 SMP Wed Dec 17 11:42:39 EST 2008 i686
i686 i386 GNU/Linux
mtndbic01:/home/ts862m/bin>