adafruit / Adafruit_CircuitPython_NTP

Network Time Protocol (NTP) Helper for CircuitPython
MIT License
9 stars 18 forks source link

Use UDP to talk to NTP servers #20

Closed tannewt closed 2 years ago

tannewt commented 2 years ago

This completely redoes the library in favor of using a native socket to fetch time from an NTP server.

Fixes #17 and fixes #16

tannewt commented 2 years ago

I'm not sure it works with ESP32SPI. get_time() on ESP32SPI already gets the time from NTP I believe.

mattura commented 2 years ago

Any chance you could add a socket timeout? My code frequently hangs during the ntp call (eg if the connection is lost), but passing a timeout can resolve this, ie. put a socket_timeout as an additional argument and then call sock.settimeout(self._socket_timeout) before the sock.sendto Cheers

tannewt commented 2 years ago

Any chance you could add a socket timeout? My code frequently hangs during the ntp call (eg if the connection is lost), but passing a timeout can resolve this, ie. put a socket_timeout as an additional argument and then call sock.settimeout(self._socket_timeout) before the sock.sendto Cheers

Please open an issue. They are much easier to track than comments on merged PRs. I don't plan on adding a timeout soon but am happy to help you do it. Let's sync on the issue.