We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 18c60dc commit f2495e3Copy full SHA for f2495e3
adafruit_ntp.py
@@ -102,6 +102,15 @@ def datetime(self) -> time.struct_time:
102
self.next_sync = destination + cache_offset * 1_000_000_000
103
seconds = struct.unpack_from("!I", self._packet, offset=PACKET_SIZE - 8)[0]
104
105
+ # value should always be larger; giving a small buffer to handle jitter.
106
+ if (seconds + 5) < self._monotonic_start:
107
+ failed_offset = (self._monotonic_start - seconds) / 1_000_000_000
108
+ raise ArithmeticError(
109
+ "need a time machine, ntp time is "
110
+ + str(failed_offset)
111
+ + "seconds in the past."
112
+ )
113
+
114
self._monotonic_start = (
115
seconds
116
+ self._tz_offset
0 commit comments