-
-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Various improvements to NtpClient class (#1482)
Tested with SystemClock_NTP sample, but note that time will be wrong as we don't yet have any timezone management in place. The sample also sets local time, but NTP provides time in UTC. No point in fixing that yet as without timezone it just makes things worse. Fix #include guard name Tidy #includes Put NTP_DEFAULT_SERVER into Flash Use const String& for parameters Use SimpleTimer instead of Timer as appropriate (efficiency, saves RAM) timeoutTimer doesn't need to be initialised until a request has been queued, so moved out of constructor Replace staticDnsResponse() with lambda Tidy extraction of timestamp from received packet using LWIP macro Rewrite using one timer Set timer to retry on initial request, and only stop it on success or cancellation Add retry if bad NTP packet received
- Loading branch information
Showing
2 changed files
with
116 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters