Tuesday, August 2, 2011

time.mktime() versus calendar.timegm()


time.mktime() assumes that the passed tuple is in local time, calendar.timegm() assumes its in GMT/UTC. Depending on the interpretation the tuple represents a different time, so the functions return different values (seconds since the epoch are UTC based).
The difference between the values should be equal to the time zone offset of your local time zone.

No comments:

Post a Comment