AceTime
0.3
Date and time classes for Arduino that support timezones from the TZ Database, and a system clock that can synchronize from an NTP server or an RTC chip.
|
A coroutine that syncs the SystemClock with its syncTimeProvider. More...
#include <SystemClockSyncCoroutine.h>
Public Member Functions | |
SystemClockSyncCoroutine (SystemClock &systemClock, uint16_t syncPeriodSeconds=3600, uint16_t initialSyncPeriodSeconds=5, uint16_t requestTimeoutMillis=1000, common::TimingStats *timingStats=nullptr) | |
Constructor. More... | |
int | runCoroutine () override |
Friends | |
class | ::SystemClockSyncCoroutineTest |
A coroutine that syncs the SystemClock with its syncTimeProvider.
Initially, the class attempts to sync with its syncTimeProvider every initialSyncPeriodSeconds. If the request fails, then it retries with an exponential backoff (doubling the delay every iteration), until the sync period becomes greater than syncPeriodSeconds, then the delay is set permanently to syncPeriodSeconds.
Definition at line 21 of file SystemClockSyncCoroutine.h.
|
inline |
Constructor.
systemClock | the system time keeper to sync up |
syncPeriodSeconds | seconds between normal sync attempts (default 3600) |
initialSyncPeriodSeconds | seconds between sync attempts when the systemClock is not initialized (default 5) |
requestTimeoutMillis | number of milliseconds before the request to syncTimeProvider times out |
timingStats | internal statistics |
Definition at line 35 of file SystemClockSyncCoroutine.h.
|
inlineoverride |
The CoroutineScheduler will use this method if enabled. Don't forget to call setupCoroutine() (inherited from Coroutine) in the global setup() to register this coroutine into the CoroutineScheduler.
Definition at line 54 of file SystemClockSyncCoroutine.h.