micropython-lib/time/example_time_tuple.py

11 wiersze
231 B
Python

import time
ts = 0
for i in range(0, 31):
ts += 1 << i
ltt = time.localtime(ts)
gtt = time.gmtime(ts)
print("ts: ", ts, " local: ", tuple(ltt), " utc: ", tuple(gtt))
lts = time.mktime(ltt)
assert ts == lts