Skip to content

Commit a923944

Browse files
committed
PR feedback, test zero
1 parent f2495e3 commit a923944

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
@@ -103,13 +103,8 @@ def datetime(self) -> time.struct_time:
103103
seconds = struct.unpack_from("!I", self._packet, offset=PACKET_SIZE - 8)[0]
104104

105105
# 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-
)
106+
if seconds == 0:
107+
raise ArithmeticError("ntp value is invalid (empty)")
113108

114109
self._monotonic_start = (
115110
seconds

0 commit comments

Comments
 (0)