Bug in Time module, or in my understanding?

Joshua J. Kugler joshua at eeinternet.com
Thu Aug 2 00:02:49 CEST 2007

I am getting results like these with the time module:

>>> import time
>>> int(time.mktime(time.strptime('2007-03-11 02:00:00', '%Y-%m-%d %H:%M
>>> int(time.mktime(time.strptime('2007-03-11 03:00:00', '%Y-%m-%d %H:%M
>>> time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(1173610800))
'2007-03-11 03:00:00'

I know it probably has something to do with daylight savings, but how can I
get back out that which I put in?  The times concerned are all standard
time, so how can I keep the time module from asserting its belief that I
want to convert to daylight savings?

Incidentally, it only happens with times on 2007-03-11  from 02:00:00 to
02:59:59, and not with time data from past years.

Thanks for any pointers!


Joshua Kugler
Lead System Admin -- Senior Programmer
PGP Key: http://pgp.mit.edu/  ID 0xDB26D7CE

More information about the Python-list mailing list