Merge branch 'bugfix/sntp_example_comment' into 'master'

examples/sntp: Document that SNTP-over-DHCP resets other NTP servers

Closes IDFGH-6835

See merge request espressif/esp-idf!17418
This commit is contained in:
David Čermák 2022-03-23 00:15:58 +08:00
commit fc21b0a789

View File

@ -22,7 +22,7 @@ See `initialize_sntp` function for details.
## Obtaining time using LwIP SNTP-over-DHCP module ## Obtaining time using LwIP SNTP-over-DHCP module
NTP server addresses could be automatically aquired via DHCP server option 42. This could be usefull on closed environments where public NTPs are not accessible NTP server addresses could be automatically acquired via DHCP server option 42. This could be useful on closed environments where public NTPs are not accessible
or to prefer local servers and reduce traffic to the outer world. or to prefer local servers and reduce traffic to the outer world.
See following menuconfig options: See following menuconfig options:
* `Component config-->LWIP-->SNTP-->Maximum number of NTP servers` * `Component config-->LWIP-->SNTP-->Maximum number of NTP servers`
@ -30,6 +30,10 @@ See following menuconfig options:
* `Component config-->LWIP-->SNTP-->Maximum number of NTP servers aquired via DHCP` * `Component config-->LWIP-->SNTP-->Maximum number of NTP servers aquired via DHCP`
* `Component config-->LWIP-->Enable LWIP Debug-->Enable SNTP debug messages` * `Component config-->LWIP-->Enable LWIP Debug-->Enable SNTP debug messages`
Please note, that `dhcp_set_ntp_servers()` does not only set NTP servers provided by DHCP, but also resets all other NTP server configured before. If you want to keep both manually configured and DHCP obtained NTP servers, please use the API in this order:
* Enable SNTP-over-DHCP before getting the IP using `sntp_servermode_dhcp()`
* Set the static NTP servers after receiving the DHCP lease using `sntp_setserver()`
## Timekeeping ## Timekeeping
Once time is synchronized, ESP32 will perform timekeeping using built-in timers. Once time is synchronized, ESP32 will perform timekeeping using built-in timers.