Bug in Time module, or in my understanding?

Joshua J. Kugler joshua at eeinternet.com
Wed Aug 1 18:02:49 EDT 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
%S')))
1173610800
>>> int(time.mktime(time.strptime('2007-03-11 03:00:00', '%Y-%m-%d %H:%M
%S')))
1173610800
>>> 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!

j

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




More information about the Python-list mailing list