need help with timezone conversion (unexpected side effect of time.mktime ??)

Ivan Velev sir.heyhey at gmail.com
Tue Jun 3 10:12:53 EDT 2008


Hello,

Minimal example below - it gives me different output if I comment /
uncomment the extra time.mktime call - note that this call is not
related in any way to main logic flow.


When "problematicStamp = ..." is commented I get
gmtStamp: 1130634600.0

when I uncomment that line I get
gmtStamp: 1130631000.0

I have tried this on a couple of Linux machines and it was
reproducible everyewhere. One of those machines has the following
Python version (If needed I can provide more details)
> Python 2.5 (r25:51908, Mar 26 2007, 23:34:03)

Any idea what' happening there ?
  Ivan



---------------

import time, os

# to see the difference, uncomment this line
# problematicStamp = time.mktime((2004, 10, 30, 4, 10, 0, 6, 303, -1))

os.putenv("TZ", "Europe/Sofia")
time.tzset()

gmtStamp = time.mktime((2005, 10, 30, 3, 10, 0, 6, 303, -1))
print "gmtStamp:", gmtStamp





More information about the Python-list mailing list