Tuesday, August 2, 2011

time.mktime() versus calendar.timegm()

http://stackoverflow.com/questions/2956886/python-calendar-timegm-vs-time-mktime


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