-
Notifications
You must be signed in to change notification settings - Fork 18
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
add configurable time between NTP calls #37
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the enhancement! Two suggestions and then it should be ready.
@@ -55,6 +56,8 @@ def __init__( | |||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll default it to zero- min(int, None) is an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thank you!
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
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.