-
Notifications
You must be signed in to change notification settings - Fork 1k
net/ntptime/ntptime.py: Allow overriding default NTP timeout. #554
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
Conversation
iabdalkader
commented
Oct 17, 2022
- The default 1 second timeout is sometimes not enough. Allow overriding the default socket timeout by passing a timeout arg.
There's also But then maybe a better way to do it is have a global variable to set the timeout. This will match how you select the NTP host. Eg: host = "pool.ntp.org"
timeout = 1
...
s.settimeout(timeout) |
I think the |
bcff017
to
4aadcff
Compare
@dpgeorge How about now ? |
But this changes the existing public API, where you change The idea behind having a global variable is that you can change it once -- configure it -- then you don't need to pass it in to (Note that it's not such bad practice having a global here, because the |
4aadcff
to
4e3429c
Compare
4e3429c
to
8a17626
Compare
Okay, I see your point, it's not important as long as we can override it somehow. Added a |
8a17626
to
a541166
Compare
* The default 1 second timeout is sometimes not enough depending on the host and network latencies. This patch makes timeout configurable.
a541166
to
be5c711
Compare
Thanks for updating. Merged in 900dd1c (and I change the default from "1.0" to "1" so it doesn't use a float if it doesn't need to). |