NTPClient icon indicating copy to clipboard operation
NTPClient copied to clipboard

Added processing of fractional time, setting of currentEpoch, sanity checking of received timestamps, and new example.

Open afdp777 opened this issue 4 years ago • 2 comments
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

afdp777 avatar Jun 09 '21 07:06 afdp777

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jun 09 '21 07:06 CLAassistant

I have couple of points:

  1. 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.
  2. I think this PR shall be split into several. Basically, each point of this PR shall be separate PR.
  3. All CI tests shall be successful.

chudsaviet avatar Sep 26 '21 06:09 chudsaviet