File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -389,7 +389,7 @@ def get_status(self) -> GameStatus:
389389 resp_json = loads (resp [1 ])
390390 if self .v :
391391 print (f"It is { resp_json ['unix_time' ]} seconds since the epoch." )
392- return GameStatus (Time (resp_json ['unix_time ' ]), resp_json ['status' ]['score' ], resp_json ['CubeServer_version' ])
392+ return GameStatus (Time (resp_json ['2020_time ' ]), resp_json ['status' ]['score' ], resp_json ['CubeServer_version' ])
393393
394394 def sync_time (self ) -> bool :
395395 """Syncs the current clock against the server"""
Original file line number Diff line number Diff line change 11"""Time Tools
22Some tools for dealing with times on microcontrollers
33(to a precision of 1 second)
4+
5+ Note that epoch time is really time since 2020 if you're using CircuitPython
46"""
57
68from time import monotonic , struct_time
2426 EDT = - 4 * TimeUnit .HOUR
2527)
2628
29+ # Offset to allow values to fit in 32-bit signed integers for CircuitPython:
30+ HIGH_PRECISION_OFFSET = TimeUnit .YEAR * 50 # 50 years since epoch to make 0 2020-01-01 00:00:00
31+
2732class Time (Immutable ):
2833 """Represents an instant in time based around a UNIX timestamp"""
2934
@@ -170,7 +175,7 @@ def __mod__(self, other: 'Time') -> 'Time':
170175
171176 def __str__ (self ) -> str :
172177 if self .absolute :
173- return f"{ self .seconds } seconds since 1 January 1970 00:00:00 UTC"
178+ return f"{ self .seconds } seconds since 1 January 2020 or 1970 00:00:00 UTC"
174179 return f"{ self .seconds } seconds"
175180
176181 def __repr__ (self ) -> str :
You can’t perform that action at this time.
0 commit comments