add configurable time between NTP calls#37
Merged
Conversation
Open
tannewt
requested changes
Jul 17, 2024
Member
tannewt
left a comment
There was a problem hiding this comment.
Thanks for the enhancement! Two suggestions and then it should be ready.
| CircuitPython. CPython will determine timezone automatically and adjust (so don't use | ||
| this.) For example, Pacific daylight savings time is -7. | ||
| :param int socket_timeout: UDP socket timeout, in seconds. | ||
| :param int cache_seconds: how many seconds to use a cached result from NTP server |
Member
There was a problem hiding this comment.
I agree that's a good default but I'd rather not change behavior. Instead, I'd default to None to indicate following the server.
Contributor
Author
There was a problem hiding this comment.
I'll default it to zero- min(int, None) is an error.
Contributor
Author
There was a problem hiding this comment.
okay, pushed the 'zero', and then changed all of the examples to use the 3600 value, since most people just copy/paste example code anyhow. Did it in a standalone commit in case you disagree and want me to revert.
adafruit-adabot
added a commit
to adafruit/Adafruit_CircuitPython_Bundle
that referenced
this pull request
Jul 23, 2024
Updating https://github.com/adafruit/Adafruit_CircuitPython_24LC32 to 1.1.1 from 1.1.0: > Merge pull request adafruit/Adafruit_CircuitPython_24LC32#24 from Timeline8/doc_fix_line_226 Updating https://github.com/adafruit/Adafruit_CircuitPython_NTP to 3.2.0 from 3.1.1: > Merge pull request adafruit/Adafruit_CircuitPython_NTP#37 from tedder/ted/configurable_cache_time_2 Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Updated download stats for the libraries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, calls to ntp are made 2**poll seconds apart. Since 0.adafruit.pool.ntp.org returns poll=3, the calls can be made every 8 seconds. Adding a way to set the request interval and defaulting to an hour, which seems like a reasonable value for a microcontroller.