MCPcopy Index your code
hub / github.com/python/cpython / timegm

Function timegm

Lib/calendar.py:834–841  ·  view source on GitHub ↗

Unrelated but handy function to calculate Unix timestamp from GMT.

(tuple)

Source from the content-addressed store, hash-verified

832
833
834def timegm(tuple):
835 """Unrelated but handy function to calculate Unix timestamp from GMT."""
836 year, month, day, hour, minute, second = tuple[:6]
837 days = datetime.date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1
838 hours = days*24 + hour
839 minutes = hours*60 + minute
840 seconds = minutes*60 + second
841 return seconds
842
843
844def main(args=None):

Callers 2

cert_time_to_secondsFunction · 0.90
_timegmFunction · 0.90

Calls 2

toordinalMethod · 0.80
dateMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…