Skip to content

Use UDP to talk to NTP servers #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 17, 2022
Merged

Use UDP to talk to NTP servers #20

merged 2 commits into from
May 17, 2022

Conversation

tannewt
Copy link
Member

@tannewt tannewt commented May 12, 2022

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

Fixes #17 and fixes #16

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

Fixes adafruit#17 and fixes adafruit#16
@tannewt tannewt requested a review from ladyada May 12, 2022 22:55
Copy link
Member

@ladyada ladyada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good - since the readme example was deleted, can you add an example for using with esp32spi?

@tannewt
Copy link
Member Author

tannewt commented May 16, 2022

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

Copy link
Member

@ladyada ladyada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gtg!

@tannewt tannewt merged commit a125f4d into adafruit:main May 17, 2022
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request May 18, 2022
Updating https://github.com/adafruit/Adafruit_CircuitPython_NTP to 3.0.0 from 2.2.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_NTP#20 from tannewt/raw_ntp
  > Patch .pre-commit-config.yaml
  > change discord badge
  > Patch: Replaced discord badge image
  > Updated gitignore
  > Update Black to latest.
  > Fixed readthedocs build
  > Consolidate Documentation sections of README
@mattura
Copy link

mattura commented Jun 29, 2022

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
Copy link
Member Author

tannewt commented Jun 29, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tz_offset is incorrectly documented in the code and documentation Dependence on adafruit_esp32spi
3 participants