Skip to content

Commit fdbb630

Browse files
author
BiffoBear
committed
Changed the retries to exponential fallback to give really slow networks a chance.
1 parent e7bd821 commit fdbb630

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

adafruit_wiznet5k/adafruit_wiznet5k_ntp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ def get_time(self) -> time.struct_time:
6969
:return time.struct_time: The local time.
7070
"""
7171
self._sock.bind((None, 50001))
72-
max_retries = 3
73-
for _ in range(max_retries):
72+
max_retries = 4
73+
for retry in range(max_retries):
7474
self._sock.sendto(self._pkt_buf_, (self._ntp_server, 123))
75-
end_time = time.monotonic() + 1
75+
end_time = time.monotonic() + 0.2 * 2**retry
7676
while time.monotonic() < end_time:
7777
data = self._sock.recv()
7878
if data:

0 commit comments

Comments
 (0)