MCPcopy Index your code
hub / github.com/RustPython/RustPython / timegm

Function timegm

Lib/calendar.py:801–808  ·  view source on GitHub ↗

Unrelated but handy function to calculate Unix timestamp from GMT.

(tuple)

Source from the content-addressed store, hash-verified

799
800
801def timegm(tuple):
802 """Unrelated but handy function to calculate Unix timestamp from GMT."""
803 year, month, day, hour, minute, second = tuple[:6]
804 days = datetime.date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1
805 hours = days*24 + hour
806 minutes = hours*60 + minute
807 seconds = minutes*60 + second
808 return seconds
809
810
811def 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