[Python-bugs-list] mktime fails on specific dates (PR#139)

taliesin@nvg.org taliesin@nvg.org
Sat, 27 Nov 1999 22:53:55 -0500 (EST)


Full_Name: 
Version: 1.5.2
OS: FreeBSD, NetBSD, OpenBSD, Solaris, A/UX
Submission from: rhiann.nvg.ntnu.no (129.241.210.114)


I was comparing dates the other day...

mktime(3), used by the time-module and indirectly by the rfc822-module, 
returns -1 for some dates on at least the mentioned os'es, for instance the 
date 'Sun, 28 Mar 1999 02:19:47'. 

The time-module raises an OverflowError, but as mktime *does* return a float
for
the above date on for instance linux, aix, irix, dec-unix and hp-ux (haven't 
tested more systems than that), it would be nice if python could catch this
somehow, for portability's sake.

solaris & freebsd:
 Sun 28 Mar 1999 01:19:47 == 922580387.0 
 Sun 28 Mar 1999 02:19:47 == -1 
 Sun 28 Mar 1999 03:19:47 == 922583987.0

aix: 
 Sun 28 Mar 1999 01:19:47 == 922580387.0
 Sun 28 Mar 1999 02:19:47 and
 Sun 28 Mar 1999 03:19:47 == 922587587.0

linux w/MET: 
 Sun 28 Mar 1999 01:19:47 MET == 922580387.0
 Sun 28 Mar 1999 02:19:47 MET == 922580387.0
 Sun 28 Mar 1999 03:19:47 MET == 922587587.0

This is a Daylights Saving Time-issue according to the bugfixers at FreeBSD, 
mktime uses the dst-info on the machine it runs on.
It won't be fixed from their end, see for instance: 
 http://www.freebsd.org/cgi/query-pr.cgi?pr=13862

Possible fixes: 
- time-module sets TZ to UCT before calling mktime
- never use localtime on a machine :)

Please look into it or mention it clearly in the docs :)


t.