retroforth/vm/nga-python/ClockDevice.py
crc ef52d0681d nga-python: run black to reformat code
FossilOrigin-Name: 2957a10f96df4dc0a9b6ca304d93e6c4331411706618c8c87deff34eeb3c36f5
2020-12-23 12:23:57 +00:00

23 lines
688 B
Python

class Clock:
def __getitem__(self, id):
import datetime
import time
now = datetime.datetime.now()
ids = {
"time": time.time,
"year": now.year,
"month": now.month,
"day": now.day,
"hour": now.hour,
"minute": now.minute,
"second": now.second,
# No time_utc?
"year_utc": now.utcnow().year,
"month_utc": now.utcnow().month,
"day_utc": now.utcnow().day,
"hour_utc": now.utcnow().hour,
"minute_utc": now.utcnow().minute,
"second_utc": now.utcnow().second,
}
return ids[id]