Skip Menu |
 

This queue is for tickets about the TimeDate CPAN distribution.

Report information
The Basics
Id: 36211
Status: resolved
Priority: 0/
Queue: TimeDate

People
Owner: Nobody in particular
Requestors: alech [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.16
Fixed in: (no value)



Subject: str2time fails on dates > 2038 (time_t overflow?)
Download (untitled) / with headers
text/plain 279b
print str2time('Dec 31 04:59:00 2040 GMT', 'UTC'); fails with the following errors: Day too big - 25932 > 24855 Sec too small - 25932 < 74752 Sec too big - 25932 > 11647 I assume this is because of a time_t overflow. Date::Parse should really be Y2038-safe ... Cheers, Alex
Subject: Re: [rt.cpan.org #36211] str2time fails on dates > 2038 (time_t overflow?)
Date: Tue, 27 May 2008 18:29:45 -0500
To: bug-TimeDate [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
Download (untitled) / with headers
text/plain 449b
On May 27, 2008, at 10:26 AM, Alexander Klink via RT wrote: Show quoted text
> > print str2time('Dec 31 04:59:00 2040 GMT', 'UTC'); > > fails with the following errors: > > Day too big - 25932 > 24855 > Sec too small - 25932 < 74752 > Sec too big - 25932 > 11647 > > I assume this is because of a time_t overflow.
Yes. Show quoted text
> Date::Parse should really > be Y2038-safe ...
Why ? If it does not fit your needs, then I suggest looking at the DateTime modules Graham.
Download (untitled) / with headers
text/plain 824b
Show quoted text
> > Date::Parse should really > > be Y2038-safe ...
> > Why?
Because time does not suddenly stop in the year 2038? Because people might want to deal with dates that far away? Because time_t is not magically 32 bits? Sorry, but you sound a bit like "I don't need four digit years" in 1999 ... Even if you really think that you have a valid point for some reason, Date::Parse should at least warn when using larger dates or mention it in the documentation. Show quoted text
> If it does not fit your needs, then I suggest looking at the > DateTime modules
Done, I have switched our project to DateTime::Format::DateParse, which I can recommend as an alternative to those who want to deal with dates in the future ... str2time() can be replaced by DateTime::Format::DateParse->parse_datetime($date, [$timezone])->epoch() Cheers, Alex
This is resolved with recent perls as Time::Local, which TimeDate uses, now supports dates > 2038


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

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.