mktime overflow in March 2008?

Tim Roberts timr at probo.com
Sat Aug 9 07:09:10 CEST 2008


Robert Latest <boblatest at yahoo.com> wrote:
>
>Here's what happens on my Windows machine (Win XP / Cygwin) at work.
>I've googled a bit about this problem but only found references to
>instances where people referred to dates before the Epoch.
>
>Of course at home on my Linux box everything works.
>
>I know that everything has its limits somewhere, but I've never
>heard of March 2008 being a problem.
>
>Tomorrow I'm going to write a test loop that shows me the exact last
>second that mktime is going to be able to handle. Sort of like the way
>Calvin's father explains the weight limit specification of bridges.

That's what it's going to sound like when I ask my question.

>...
>>>> t = time.strptime("Mar 30, 2008 2:43:32 am", "%b %d, %Y %I:%M:%S
>>>> %p")
>>>> time.mktime(t)
>Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>OverflowError: mktime argument out of range

What time zone are you in?  March 30, 2008, was a Sunday.  If that happened
to be the date your country transitioned to summer time, then the hour
between 2 AM and 3 AM would not exist.

Does it work if you use 3:43 AM?
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list