retroforth/vm/nga-python/ClockDevice.py
crc f212b7fcea nga-python: start adding files from the rework towards a class based implementation
FossilOrigin-Name: b56fcd9e7f5f44c0f0572aa19dc423a94bbb849d593cc07621af063acb51e124
2020-11-18 20:20:04 +00:00

21 lines
644 B
Python

class Clock:
def __getitem__(self, id):
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]