retroforth/vm/nga-python/ClockDevice.py
crc 1b0fa54eef nga-python: commit updates to class-based vm implementation
FossilOrigin-Name: f6f51a35193443a3fb5735b5cf742b82bafd9810aab098fe9376847ac948b4b1
2020-12-02 20:18:58 +00:00

20 lines
643 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]