-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
DHCP NTP Server configurable #5681
Comments
Would this be solved by sending In terms of implementation, it looks like lines 540-548 of dhcp.c check whether an option was returned and get the value that was returned. 918-930 appear to show how to set what options we are going to request. Lines 1441-1493 parse the returned options. Does this all sound like the way to implement this? |
Not in This functionality is a harcoded option in our configuration. Do you need to disable the feature or being able to add other servers ?
Since |
So you are saying there is already a way to get local ntp servers from the dhcp server using |
The first NTP server given by a properly configured DHCP server is automatically used in the ESP with lwIP-v2. |
I don't mean to hijack the thread here but where is there an example of that? The only ntp example I am familiar with is |
lwip2 is a submodule of our repo. It is an adaptation layer for upstream lwIP. The source code of If you run with git and linux, just try
Source code will be downloaded from there and compiled.
If your DHCP server has NTP server settings properly configured, and if your sketch uses DHCP, and if you select lwIP-v2 (default selection anyway), then your ESP is synchronized with NTP. |
I don't see how to do this and I don't see an example of this. The only example I can find is |
Sorry for the noise, since I now figured it out. It takes a second or 2 after the IP address is assigned by DHCP for the time to get updated. It just becomes unnecessary for a line like |
Perhaps, example should take note of that? We can access ntp server list via sntp_getserver(idx) on setup() Secondly, I do see that this behaviour can be disabled: |
The NTP-TZ-DST example explains NTP server is coming from DHCP.
I'm not sure changing default behavior is safe.
(to be tested and proposed as a PR) |
configTime can be before WiFi.begin(), though, but any order makes sntp respect configTime setting. With dnsmasq configuration containing But I was wondering if it is ok to give out lwip api instead of something Core-specific
Yes, and lwip initializes sntp automatically, even without configTime present. But that's another issue altogether with how sntp app works |
Hello
Is it possible that you can make an option at the init of the ntp client that you can say your NTP server you get from the DHCP, manualy or both? At the moment, i have troubles with mirkotik router as DHCP that i can't change the NTP Server in Tasmota because the client alwys use the NTP from the DHCP Server.
If i don't set a ntp Server at the dhcp he also use a adress of the dhcp.
PEter
The text was updated successfully, but these errors were encountered: