NTPClient
NTPClient copied to clipboard
Enable fractional second timestamps (re-integration of #102)
Since PR #102 seems inactive this rebases the changes from that PR to master and fixes the remaining CI issues.
Description of the original PR:
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()
In addition this PR fixes some spelling and white space issues of the original PR and refactors the new example to look more idiomatic as compared to the existing examples.
CI passes and I compiled all examples for NodeMCU and tested on actual hardware.
Memory usage change @ e4d04dd53cb3f07eed06fb785c35d0e398692540
| Board | flash | % | RAM for global variables | % |
|---|---|---|---|---|
| esp8266:esp8266:huzzah | :small_red_triangle: +1744 - +1744 | +0.17 - +0.17 | :small_red_triangle: +192 - +192 | +0.23 - +0.23 |
Click for full report table
| Board | examples/Advanced flash |
% | examples/Advanced RAM for global variables |
% | examples/Basic flash |
% | examples/Basic RAM for global variables |
% | examples/HiRes flash |
% | examples/HiRes RAM for global variables |
% | examples/IsTimeSet flash |
% | examples/IsTimeSet RAM for global variables |
% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| esp8266:esp8266:huzzah | 1744 | 0.17 | 192 | 0.23 | 1744 | 0.17 | 192 | 0.23 | N/A | N/A | N/A | N/A | 1744 | 0.17 | 192 | 0.23 |
Click for full report CSV
Board,examples/Advanced<br>flash,%,examples/Advanced<br>RAM for global variables,%,examples/Basic<br>flash,%,examples/Basic<br>RAM for global variables,%,examples/HiRes<br>flash,%,examples/HiRes<br>RAM for global variables,%,examples/IsTimeSet<br>flash,%,examples/IsTimeSet<br>RAM for global variables,%
esp8266:esp8266:huzzah,1744,0.17,192,0.23,1744,0.17,192,0.23,N/A,N/A,N/A,N/A,1744,0.17,192,0.23
Hi, any progress on merging this?
@chudsaviet I haven't received any feedback on this PR, and frankly by now I no longer have any use for it because I implemented an NTP client for the project I was working on from scratch to address this and a couple of other requirements I had that the NTPClient project seemed reluctant to address.
@tickelton , would you mind if I take this commit over and make it production-ready?
@chudsaviet you are welcome to do so.