NTPClient
NTPClient copied to clipboard
Added processing of fractional time, setting of currentEpoch, sanity checking of received timestamps, and new example.
trafficstars
Hello! I humbly present my contribution to the NTPClient library. I've tried not to change much of the way the library works and aimed to improve on it instead. Here are the changes that I made:
Added processing of fractional time in forceUpdate() to allow syncing to the exact NTP time. Added sanity checking of received timestamp before using it. Added millis() rollover protection in getEpochTime(). Added new function, setEpochTime(), to set NTPClient's internal currentEpoch from hardware RTC time. Changed the default updateInterval to 1 hour. Added 'Advanced_with_RTC' example to demonstrate new capabilities and accuracy.
Sincerely, afdp777
I have couple of points:
- It conflicts with https://github.com/arduino-libraries/NTPClient/pull/146 . I have no problems if you complete this PR instead of the latter. We just need fractional time support.
- I think this PR shall be split into several. Basically, each point of this PR shall be separate PR.
- All CI tests shall be successful.