OverflowError: mktime argument out of range ???

Paul Boddie paul at boddie.org.uk
Mon Apr 16 17:02:19 CEST 2007

John Machin wrote:
> Maybe it does. It sure would be nice to get a definite answer. Pity
> nobody documented the time module.

"The epoch is the point where the time starts. On January 1st of that
year, at 0 hours, the ``time since the epoch'' is zero. For Unix, the
epoch is 1970. To find out what the epoch is, look at gmtime(0)."

"The functions in this module do not handle dates and times before the
epoch or far in the future."


> >  >>> import time
> >  >>> time.mktime((1928, 12,28, 0, 0, 0,  0, 0, 0))
> > -1294164000.0

I think the consensus is that you're lucky if your system (the C
library, more specifically) lets you play with negative time values.
Here, the inquirer happens to be playing with negative time values
(under the time module's API) and should therefore consider using the
datetime module instead.


More information about the Python-list mailing list