python mktime fails with overflow (same call works in other environments)

Aran Cox arancox at gmail.com
Thu Sep 25 13:53:03 PDT 2008


On Thu, Sep 25, 2008 at 10:06:53AM -0500, Aran Cox wrote:
> On Thu, Sep 25, 2008 at 08:09:51AM +0900, YONETANI Tomokazu wrote:
> > On Wed, Sep 24, 2008 at 01:53:58PM -0500, Aran Cox wrote:
> > > mktime is failing in python2.4 and python2.5 under DragonflyBSD 2.0
> > > for certain date/times:
> > > 
> > > >>> from time import mktime
> > > >>> tt=(2006, 4, 2, 2, 16, 27, -1, -1, -1)
> > > >>> mktime(tt)
> > > Traceback (most recent call last):
> > >   File "<stdin>", line 1, in ?
> > > OverflowError: mktime argument out of range
> > > 
> > > When I run the above python snippet on any other system I have access
> > > to (Fedora 9, OpenBSD 4.1, etc.) I get:
> > > 
> > > >>> mktime(tt)
> > > 1143944187.0
> > 
> > It works as expected(1143944187.0) here with python2.5 built from pkgsrc,
> > on DragonFly 2.0 or 2.1.
> > 
> > Cheers.

It seems that if the TZ environment is set (I tested America/Chicago and
GMT) the c/python/perl programs all work.  If unset, (even though
localtime exists, and corresponds to America/Chicago) all three
programs fail to call mtime.  

I think may have been setting TZ and confused the issue slightly when
testing the c and perl programs.  

Still, should TZ be set by the installer?  Where is the proper place
to set TZ in DragonflyBSD?  I certainly didn't unset it (intentionally
or otherwise.)  






More information about the Users mailing list