AceTime
0.1
Date and time classes for Arduino that supports the TZ DAtabase, and a system clock synchronized from an NTP server or an RTC chip.
|
A coroutine that syncs the SystemTimeKeeper with its syncTimeProvider. More...
#include <SystemTimeSyncCoroutine.h>
Public Member Functions | |
SystemTimeSyncCoroutine (SystemTimeKeeper &systemTimeKeeper, uint16_t syncPeriodSeconds=3600, uint16_t initialSyncPeriodSeconds=5, uint16_t requestTimeoutMillis=1000, common::TimingStats *timingStats=nullptr) | |
Constructor. More... | |
int | runCoroutine () override |
Friends | |
class | ::SystemTimeSyncCoroutineTest |
A coroutine that syncs the SystemTimeKeeper 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 SystemTimeSyncCoroutine.h.
|
inline |
Constructor.
systemTimeKeeper | the system time keeper to sync up |
syncPeriodSeconds | seconds between normal sync attempts (default 3600) |
initialSyncPeriodSeconds | seconds between sync attempts when the systemTimeKeeper 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 SystemTimeSyncCoroutine.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 SystemTimeSyncCoroutine.h.