Marc-Andre Lemburg <m...@egenix.com> added the comment:

JoeKuan wrote:
> 
> New submission from JoeKuan <kuan....@gmail.com>:
> 
>>>> a = (1970, 1, 1, 0, 59, 58, 0, 0, 0)
>>>> time.mktime(a)
> -2.0

On Windows, you get an OverflowError for this tuple as well.

>>>> a = (1970, 1, 1, 0, 59, 59, 0, 0, 0)
>>>> time.mktime(a)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> OverflowError: mktime argument out of range
> 
>>>> a = (1970, 1, 1, 1, 0, 0, 0, 0, 0)
>>>> time.mktime(a)
> 0.0
> 
>>>> a = (1970, 1, 1, 0, 59, 60, 0, 0, 0)
>>>> time.mktime(a)
> 0.0

Note that time.mktime() is direct interface to the C lib
funtion of the same name. As a result, the support for
the various values is platform dependent. In general,
dates before the epoch tend not to work or give wrong
results.

Since mktime() works on local time, the time zone
in affect on 1970-01-01 matters and that's why you are
seeing the OverflowError even for values after
1970-01-01 00:00:00.

----------
nosy: +lemburg
title: mktime - OverflowError: mktime argument out of range - on very specific 
time -> mktime - OverflowError: mktime argument out of range -   on very 
specific time

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11850>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to