AceTimeClock
1.3.0
Clock classes for Arduino that can synchronize from an NTP server or an RTC chip
|
An implementation of Clock that works on Unix using EpoxyDuino. More...
#include <UnixClock.h>
Public Member Functions | |
void | setup () |
Setup function that currently does nothing. | |
acetime_t | getNow () const override |
Return the number of seconds since the AceTime epoch (2000-01-01T00:00:00Z). More... | |
![]() | |
Clock ()=default | |
Default constructor. | |
~Clock ()=default | |
We deliberately avoid using a virtual destructor. More... | |
virtual void | sendRequest () const |
Send a time request asynchronously. | |
virtual bool | isResponseReady () const |
Return true if a response is ready. | |
virtual acetime_t | readResponse () const |
Returns number of seconds since AceTime epoch (2000-01-01). More... | |
virtual void | setNow (acetime_t) |
Set the time to the indicated seconds. More... | |
Additional Inherited Members | |
![]() | |
static const acetime_t | kInvalidSeconds = LocalTime::kInvalidSeconds |
Error value returned by getNow() and other methods when this object is not yet initialized. | |
An implementation of Clock that works on Unix using EpoxyDuino.
Definition at line 21 of file UnixClock.h.
|
inlineoverridevirtual |
Return the number of seconds since the AceTime epoch (2000-01-01T00:00:00Z).
Returns kInvalidSeconds if an error has occured.
This is a blocking call. Some clocks (e.g. NTP client) this may take many seconds. On those clocks, use the asynchronous methods (sendRequest(), isResponseReady(), and readResponse()) instead.
Since acetime_t
is a 32-bit integer, this method is valid if the current Unix time() is within about +/- 68 years of the current epoch being used by the AceTime library, as defined by Epoch::currentEpochYear()
.
Implements ace_time::clock::Clock.
Definition at line 36 of file UnixClock.h.