6 #ifndef ACE_TIME_DS3231_CLOCK_H 7 #define ACE_TIME_DS3231_CLOCK_H 9 #if defined(ARDUINO) || defined(DOXYGEN) 12 #include "../hw/DS3231.h" 13 #include "../hw/HardwareDateTime.h" 14 #include "../LocalDateTime.h" 35 void setNow(acetime_t epochSeconds)
override {
36 if (epochSeconds == kInvalidSeconds)
return;
50 dt.hour, dt.minute, dt.second);
uint8_t minute() const
Return the minute.
void readDateTime(HardwareDateTime *dateTime) const
Read the time into the HardwareDateTime object.
uint8_t day() const
Return the day of the month.
int8_t yearTiny() const
Return the single-byte year offset from year 2000.
static LocalDateTime forEpochSeconds(acetime_t epochSeconds)
Factory method.
An implementation of Clock that uses a DS3231 RTC chip.
void setDateTime(const HardwareDateTime &dateTime) const
Set the DS3231 with the HardwareDateTime values.
uint8_t month() const
Return the month with January=1, December=12.
static LocalDateTime forComponents(int16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second)
Factory method using separated date and time components.
acetime_t toEpochSeconds() const
Return seconds since AceTime epoch 2000-01-01 00:00:00Z, after assuming that the date and time compon...
uint8_t hour() const
Return the hour.
uint8_t dayOfWeek() const
Return the day of the week, Monday=1, Sunday=7 (per ISO 8601).
uint8_t second() const
Return the second.
static const int16_t kEpochYear
Base year of epoch.
The date (year, month, day) and time (hour, minute, second) fields supported by the DS3231 RTC chip...
acetime_t getNow() const override
Return the number of seconds since the AceTime epoch (2000-01-01T00:00:00Z).
A class that reads and writes HardwareDateTime and HardwareTemperature from a DS3231 RTC chip...
Base class for objects that provide and store time.
Class that holds the date-time as the components (year, month, day, hour, minute, second) without reg...
void setNow(acetime_t epochSeconds) override
Set the time to the indicated seconds.