time.mktime memory access violation bug

Bengt Richter bokr at oz.net
Wed Nov 19 17:34:16 EST 2003


On Wed, 19 Nov 2003 02:10:36 +0100, Irmen de Jong <irmen at -NOSPAM-REMOVETHIS-xs4all.nl> wrote:

>Bengt Richter wrote:
>>  Python 2.3.2 (#49, Oct  2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
>>  Type "help", "copyright", "credits" or "license" for more information.
>>  >>> import time
>>  >>> time.mktime((1969, 12, 31, 17, 0, 0, 0, 0, 0))
>>  3600.0
>>  >>> time.mktime((1969, 12, 31, 17, 0, 0, 0, 0, 1))
>>  0.0
>>  >>> time.mktime((1969, 12, 31, 16, 0, 0, 0, 0, 1))
>>  [crash with popup]
>
>Curious. I get (windows XP):
>
>Python 2.3.2 (#49, Oct  2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32
>Type "help", "copyright", "credits" or "license" for more information.
> >>> import time
> >>> time.mktime((1969, 12, 31, 17, 0, 0, 0, 0, 0))
>Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>OverflowError: mktime argument out of range
> >>> time.mktime((1969, 12, 31, 17, 0, 0, 0, 0, 1))
>Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>OverflowError: mktime argument out of range
> >>> time.mktime((1969, 12, 31, 16, 0, 0, 0, 0, 1))
>Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>OverflowError: mktime argument out of range
> >>>
>
>On Linux I get the same results. Something fishy is going
>on with your Python...
>
Well, you're in a different time zone. I think you have to compensate for
that in setting up the equivalent of zero time epoch. Then hit that with dst=1.
Or there could be something fishy ;-)

Regards,
Bengt Richter




More information about the Python-list mailing list