1class Clock: 2 def __getitem__(self, id): 3 import datetime 4 import time 5 6 now = datetime.datetime.now() 7 ids = { 8 "time": time.time, 9 "year": now.year, 10 "month": now.month, 11 "day": now.day, 12 "hour": now.hour, 13 "minute": now.minute, 14 "second": now.second, 15 # No time_utc? 16 "year_utc": now.utcnow().year, 17 "month_utc": now.utcnow().month, 18 "day_utc": now.utcnow().day, 19 "hour_utc": now.utcnow().hour, 20 "minute_utc": now.utcnow().minute, 21 "second_utc": now.utcnow().second, 22 } 23 return ids[id] 24