Increase time accuracy
- increase time accuracy to not above 100ms
- complete decimal part of NTP
- use high-freq polling
- add _current_epoc_dec and get_millis() so that ms can be known
- rewrite update()
- solved overflow problem
- change update()'s return type to byte in order to carry more info
- add a not-request-too-fast feature by adding _last_fail in update()
I also add a demo program. I set an NTP Server in my LAN. In this network condition, the time error can be reduced to no more than plus-minus 10ms.
Any plan to fix and merge this PR soon ?
The build fails for these 2 errors:
/home/travis/build/arduino-libraries/NTPClient/examples/ntp_demo.ino: In function 'void connect_wifi(char*, char*)':
ntp_demo:28:25: error: 'class WiFiClass' has no member named 'channel'
Serial.println(WiFi.channel());
^
ntp_demo:30:25: error: 'class WiFiClass' has no member named 'getAutoReconnect'
Serial.println(WiFi.getAutoReconnect());
Unluckily the functions channel and getAutoReconnect exist in WiFi, so it's strange that gives such errors. @Testato can you do a check and let us know ?
I have tested these codes on my esp32. It works very well. It has run for half a month without a bug or crash.
These prints are not important. They are just showing what information one can get from WiFi.
According to log the build is done with platform esp8266, which is a little bit different from esp32. I hope that all Arduino library functions are present in every supported platform.
Any plans to get this merged?