MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / timegm

Function timegm

tools/python-3.11.9-amd64/Lib/calendar.py:653–660  ·  view source on GitHub ↗

Unrelated but handy function to calculate Unix timestamp from GMT.

(tuple)

Source from the content-addressed store, hash-verified

651
652
653def timegm(tuple):
654 """Unrelated but handy function to calculate Unix timestamp from GMT."""
655 year, month, day, hour, minute, second = tuple[:6]
656 days = datetime.date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1
657 hours = days*24 + hour
658 minutes = hours*60 + minute
659 seconds = minutes*60 + second
660 return seconds
661
662
663def main(args):

Callers 2

cert_time_to_secondsFunction · 0.90
_timegmFunction · 0.90

Calls 2

toordinalMethod · 0.80
dateMethod · 0.45

Tested by

no test coverage detected