You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can not see a way to implement a NTP client. NTP client is not a documented feature and the UDP implementation only supports string handling. The NTP message consists of a 384 bit or 48 byte data structure containing 17 fields which require raw data, not string. There is a nice (simple) guide to implementing a NTP client here: https://lettier.github.io/posts/2016-04-26-lets-make-a-ntp-client-in-c.html.
The text was updated successfully, but these errors were encountered:
Or an implementation on the Arduino playground: http://playground.arduino.cc/Code/NTPclient which is fairly simple. Neither of these calculate the loop delay (the Arduino version assumes 50ms) but for most purposes, getting one second accuracy is fine. Even the rounding done in the Arduino code may be excessively accurate for most purposes.
I have now found that SNTP is already implemented and an enhancement planned http://www.esp8266.com/viewtopic.php?f=43&t=11510&p=54024&hilit=ntp#p54024. It would be advantageous for this to be documented. I was perplexed when the device magically knew the time. It may also be advantageous to be able to set the time manually in case Internet is not available. Also, able to get the unix timestamp rather than just human readable format, so that program can easily compare values, etc.
I can not see a way to implement a NTP client. NTP client is not a documented feature and the UDP implementation only supports string handling. The NTP message consists of a 384 bit or 48 byte data structure containing 17 fields which require raw data, not string. There is a nice (simple) guide to implementing a NTP client here: https://lettier.github.io/posts/2016-04-26-lets-make-a-ntp-client-in-c.html.
The text was updated successfully, but these errors were encountered: