Closed
Description
My code frequently hangs during the ntp call (eg if the connection is lost)
Passing a socket timeout through the function could resolve this or at least allow my code to continue after a short delay
eg:
def __init__(
self,
socketpool,
*,
server: str = "0.adafruit.pool.ntp.org",
port: int = 123,
tz_offset: int = 0,
socket_timeout = 10
) -> None:
...
self._socket_timeout = socket_timeout
...
def datetime(self) -> time.struct_time:
...
with self._pool.socket(self._pool.AF_INET, self._pool.SOCK_DGRAM) as sock:
sock.settimeout(self._socket_timeout)
sock.sendto(self._packet, (self._server, self._port))
...
Metadata
Metadata
Assignees
Labels
No labels