Python: Convert UTC time-tuple to UTC timestamp
-
time.mktime(tuple)
: this function always returns the timestamp in local time.This is the inverse function of localtime(). Its argument is the struct_time or full 9-tuple which expresses the time in local time, not UTC.
-
calendar.timegm(tuple)
: this returns the UTC timestamp from the supplied time tupletakes a time tuple such as returned by the gmtime() function in the time module, and returns the corresponding Unix timestamp value. In fact, time.gmtime() and timegm() are each others’ inverse