-
Notifications
You must be signed in to change notification settings - Fork 11
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
Resync NTP regurlarly #134
base: main
Are you sure you want to change the base?
Conversation
Seems ok |
Let's wait at least for the results of the tests of @McMagellan |
The rescheduling is done twice: both in |
@RichieB2B Two things. The difference in time was indeed wrong. However, the double call to |
@CurlyMoo So an extra call to timerqueue_inserts(x, y, -5) would just reset the previous timer. That's much less of an issue than I thought but still good to avoid it. |
@RichieB2B Exactly. |
Feedback: Testing time synchronization. Alpha-467a907, #527 Method:
|
@CurlyMoo why not use some basic logic, just 2 variables, one boolen for time sync'ed flag, and one last time synced (timestamp after timesync) and check by that.. if it's never synced (try every 5min) and if synced try after last sync_time timeout. |
That's what we're basicly doing here, but centralized through the timepool. |
Oh, sorry, i saw somewhere you mentioned exact dates.. so thought it tied to dates :) didn't check source. |
It does, because by definition unix time starts on the 1st of januari 1970. So, checking for a year other than 1970 is similar to that sync flag but with more accuracy of success. |
@McMagellan Can you let it run again for a while and check for the |
Feedback: Testing time synchronization. Alpha baddb94, #531 How I do it:
LED WLAN and DSL on Fritzbox1 flash for about 5 - 6 minutes until the PC browser is connected to the WLAN again. For the next attempt, I activated "Debug log to MQTT topic from start" to have the messages recorded in the influxdb immediately after reconnection. The timestamp at the beginning of the line comes from the Raspberry. |
@CurlyMoo: How can i do this? |
I did another test on synchronizing the date and time. This process was recorded in the first console window. You can see that the time has been updated. Security notice: |
Please do! |
Why do you need two timers? The code from timer -6 could look like this:
and then in systemboot just call it after a minute.
And then delete timer -5... |
Because in your case you're always doing a |
Only once, right after the systemboot.
and
|
Same thing. You are already doing a ntpReload while you haven't checked if the previous ntpReload succeeded. |
And i don't see why using two timers is an issue? They're not active at the same time so aren't a performance issue at all. |
It is just doing it the other way around:
It is less code and easier to read. Less code is easier to maintain. |
No it isn’t, because ntpReload is an async function.
|
Oh, ok... sorry. My spaghetti-code-brain has problems processing things like that and I didn't know it is async... |
When the year is 1970 resync every 5 minutes. If the date is properly set, resync every day.