AceTime
1.7.1
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.
|
6 #ifndef ACE_TIME_DS3231_CLOCK_H
7 #define ACE_TIME_DS3231_CLOCK_H
10 #include "../hw/DS3231.h"
11 #include "../hw/HardwareDateTime.h"
12 #include "../LocalDateTime.h"
33 void setNow(acetime_t epochSeconds)
override {
48 dt.hour, dt.minute, dt.second);
62 const hw::DS3231 mDS3231;
uint8_t dayOfWeek() const
Return the day of the week, Monday=1, Sunday=7 (per ISO 8601).
uint8_t hour() const
Return the hour.
Class that holds the date-time as the components (year, month, day, hour, minute, second) without reg...
acetime_t getNow() const override
Return the number of seconds since the AceTime epoch (2000-01-01T00:00:00Z).
An implementation of Clock that uses a DS3231 RTC chip.
void setDateTime(const HardwareDateTime &dateTime) const
Set the DS3231 with the HardwareDateTime values.
void setNow(acetime_t epochSeconds) override
Set the time to the indicated seconds.
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.
uint8_t month() const
Return the month with January=1, December=12.
uint8_t second() const
Return the second.
void readDateTime(HardwareDateTime *dateTime) const
Read the time into the HardwareDateTime object.
uint8_t minute() const
Return the minute.
Abstract base class for objects that provide and store time.
acetime_t toEpochSeconds() const
Return seconds since AceTime epoch 2000-01-01 00:00:00Z, after assuming that the date and time compon...
static const int16_t kEpochYear
Base year of epoch.
static const acetime_t kInvalidSeconds
Error value returned by getNow() and other methods when this object is not yet initialized.
int8_t yearTiny() const
Return the single-byte year offset from year 2000.
uint8_t day() const
Return the day of the month.
The date (year, month, day) and time (hour, minute, second) fields supported by the DS3231 RTC chip.
static LocalDateTime forEpochSeconds(acetime_t epochSeconds)
Factory method.