Skip to content

Change sntp default update interval to 6 hours. #5824

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

Closed
wants to merge 2 commits into from
Closed

Change sntp default update interval to 6 hours. #5824

wants to merge 2 commits into from

Conversation

CelliesProjects
Copy link
Contributor

@CelliesProjects CelliesProjects commented Nov 1, 2021

Summary

Change sntp default update interval from 1 to 6 hours.

Impact

This PR aims at reducing the amount of requests sent to the (free as-in-beer and community run) ntp time servers.
The amount of requests for the ntp project should be a a lot less (per esp32) than with the current settings.

Rationale

Just from my home network with 5 esp32 controllers there are more than 100 ntp requests per day with the 1 hour update interval.
The ntp project is a community run service and open source projects should strive to minimize their impact on this service.

This will result in less traffic to the (free and community run) sntp servers.
Change the sntp update interval to 6 hours.
@CLAassistant
Copy link

CLAassistant commented Nov 1, 2021

CLA assistant check
All committers have signed the CLA.

@chegewara
Copy link
Contributor

Did you check what is time drift with internal RTC on esp32?

@atanisoft
Copy link
Collaborator

This change can not be applied here, it would need to be applied upstream (https://github.com/espressif/esp-lwip and/or https://github.com/espressif/esp-idf) OR change CONFIG_LWIP_SNTP_UPDATE_DELAY from the current one hour value to your required value.

Changing to six hours though is a bit excessive as typically one hour is what most systems use today.

@CelliesProjects
Copy link
Contributor Author

CelliesProjects commented Nov 1, 2021

@atanisoft Thanks for the links.
Maybe 6 hours is too long between updates, but every hour does seem excessive.

@chegewara I already had some challenges with sntp and I measured a drift of about 10s per day.
(That is +- 5sec)
See #1114
The main contribution is (as with any clock) the temperature.
Hot clocks run fast, cold clocks run slow.

@chegewara
Copy link
Contributor

chegewara commented Nov 1, 2021

On esp32 RTC drift is about 5%, which is 180s per hour.

@atanisoft
Copy link
Collaborator

Maybe 6 hours is too long between updates, but every hour does seem excessive.

Perhaps change to three hours? You can submit a PR to https://github.com/espressif/esp32-arduino-lib-builder and update all sdkconfig. files and once @me-no-dev approves it will be available in arduino-esp32 via PR after about six hours.

@CelliesProjects
Copy link
Contributor Author

@atanisoft I am a bit confused by the different repos.
The most upstream is the esp-lwip repo? From there it would propagate to idf and arduino?

@atanisoft
Copy link
Collaborator

esp-lwip is where the file you edited comes from, however, in esp-idf the config parameter is exposed and configured with a default which overrides the one you edited. esp32-arduino-lib-builder is where the sdkconfig files come from that are used to build the binary bits for this repository. LwIP and it's defaults are compiled into the binary and very likely in the default SNTP implementation your change would have little or no impact.

@CelliesProjects
Copy link
Contributor Author

Closing this PR and continuing on https://github.com/espressif/esp32-arduino-lib-builder

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.

4 participants