Skip to content

Commit 4a078fc

Browse files
committed
PR feedback, test zero
1 parent 1c4456b commit 4a078fc

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

adafruit_ntp.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,8 @@ def datetime(self) -> time.struct_time:
9696
seconds = struct.unpack_from("!I", self._packet, offset=PACKET_SIZE - 8)[0]
9797

9898
# value should always be larger; giving a small buffer to handle jitter.
99-
if (seconds + 5) < self._monotonic_start:
100-
failed_offset = (self._monotonic_start - seconds) / 1_000_000_000
101-
raise ArithmeticError(
102-
"need a time machine, ntp time is "
103-
+ str(failed_offset)
104-
+ "seconds in the past."
105-
)
99+
if seconds == 0:
100+
raise ArithmeticError("ntp value is invalid (empty)")
106101

107102
self._monotonic_start = (
108103
seconds

0 commit comments

Comments
 (0)