On Tue, Jul 05, 2005 at 10:30:02AM -0700, Scott Godin wrote:
> $ date -d 'July 4, 1901' +%s | perl -lne 'print scalar localtime $_'
> Fri Dec 13 15:45:52 1901
> >$ date -d 'July 4, 1902' +%s | perl -lne 'print scalar localtime $_'
> Fri Jul  4 00:00:00 1902
> 
> but clearly, neither do perl's (for the date ranges I actually need). 
> something
> else is indeed wonky within Date::Parse. Please investigate. 

Two comments.

First, Date::Parse is not part of the perl core, therefore you will need
to raise any issues with the module's author rather than with us.

Second, there are absolutely no guarantees what will happen on UNIX
systems for dates < 1970. It so happens that on your system, the system
libraries appear to be treating the time value as a signed number, so
dates happen to range from Dec 1901 to Jan 2038; on other systems it can
be viewed as an unsigned number, so dates can range from 1970 to 2106.

If you want to write portable code that handles dates outside the
1970-2037 range, then don't use libraries that return a UNIX-style
seconds-since-1970 value.

Note that perl's localtime and gmtime functions just call the underlying
C library localtime and gmtime functions.

-- 
Lady Nancy Astor: If you were my husband, I would flavour your coffee
with poison.
Churchill: Madam - if I were your husband, I would drink it.

Reply via email to