NTP examples 2 seconds behind
Posted: Sun Apr 28, 2019 5:38 am
Hi,
For my very first ESP8266 project, I need the current time. I've tested some NTP examples, but all of them are 2 seconds behind, compared to the PC that's configured to use the same NTP server as my test sketch.
It's not network delay ... in nearly all cases, the time between sending the NTP request and getting the reply is way below 1 second.
These are the sketches I've tested:
What can I do to get a more accurate time ?
For my very first ESP8266 project, I need the current time. I've tested some NTP examples, but all of them are 2 seconds behind, compared to the PC that's configured to use the same NTP server as my test sketch.
It's not network delay ... in nearly all cases, the time between sending the NTP request and getting the reply is way below 1 second.
These are the sketches I've tested:
- https://tttapa.github.io/ESP8266/Chap15%20-%20NTP.html
https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/NTPClient/NTPClient.ino
What can I do to get a more accurate time ?