6 #ifndef ACE_TIME_ZONED_DATE_TIME_H 7 #define ACE_TIME_ZONED_DATE_TIME_H 10 #include "common/flash.h" 11 #include "OffsetDateTime.h" 55 year, month, day, hour, minute, second);
139 int16_t
year()
const {
return mOffsetDateTime.
year(); }
157 uint8_t
day()
const {
return mOffsetDateTime.
day(); }
163 uint8_t
hour()
const {
return mOffsetDateTime.
hour(); }
257 return mOffsetDateTime.
compareTo(that.mOffsetDateTime);
265 void printTo(Print& printer)
const;
273 static const uint8_t kDateStringLength = 25;
279 mOffsetDateTime(offsetDateTime),
294 return a.mOffsetDateTime == b.mOffsetDateTime
295 && a.mTimeZone == b.mTimeZone;
static const acetime_t kSecondsSinceUnixEpoch
Number of seconds from Unix epoch (1970-01-01 00:00:00Z) to the AceTime epoch (2000-01-01 00:00:00Z)...
uint8_t dayOfWeek() const
Return the day of the week using ISO 8601 numbering where Monday=1 and Sunday=7.
uint8_t minute() const
Return the minute.
static const acetime_t kDaysSinceUnixEpoch
Number of days from Unix epoch (1970-01-01 00:00:00Z) to the AceTime epoch (2000-01-01 00:00:00Z)...
uint8_t second() const
Return the second.
void yearTiny(int8_t yearTiny)
Set the single-byte year offset from year 2000.
static const acetime_t kInvalidEpochDays
Sentinel epochDays which indicates an error.
int8_t yearTiny() const
Return the single-byte year offset from year 2000.
acetime_t toEpochDays() const
Return number of whole days since AceTime epoch (2000-01-01 00:00:00Z), taking into account the offse...
static const acetime_t kInvalidEpochSeconds
Sentinel epochSeconds which indicates an error.
TimeOffset timeOffset() const
Return the offset zone of the OffsetDateTime.
uint8_t dayOfWeek() const
Return the day of the week, Monday=1, Sunday=7 (per ISO 8601).
acetime_t toUnixDays() const
Return the number of days since Unix epoch (1970-01-01 00:00:00).
acetime_t toEpochSeconds() const
Return seconds since AceTime epoch (2000-01-01 00:00:00Z), taking into account the time zone...
uint8_t month() const
Return the month with January=1, December=12.
uint8_t hour() const
Return the hour.
uint8_t day() const
Return the day of the month.
void second(uint8_t second)
Set the second.
void hour(uint8_t hour)
Set the hour.
acetime_t toUnixSeconds() const
Return the number of seconds from Unix epoch 1970-01-01 00:00:00Z.
void day(uint8_t day)
Set the day of the month.
acetime_t toUnixSeconds() const
Return the number of seconds from Unix epoch 1970-01-01 00:00:00Z.
int8_t compareTo(const OffsetDateTime &that) const
Compare this OffsetDateTime with another OffsetDateTime, and return (<0, 0, >0) according to whether ...
static ZonedDateTime forError()
Return an instance whose isError() returns true.
OffsetDateTime getOffsetDateTime(const LocalDateTime &ldt) const
Return the best estimate of the OffsetDateTime at the given LocalDateTime for the current TimeZone...
static OffsetDateTime forEpochSeconds(acetime_t epochSeconds, TimeOffset timeOffset)
Factory method.
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.
const TimeZone & timeZone() const
Return the time zone of the ZonedDateTime.
TimeOffset timeOffset() const
Return the offset zone of the OffsetDateTime.
static ZonedDateTime forDateString(const char *dateString)
Factory method.
void year(int16_t year)
Set the year given the full year.
static ZonedDateTime forComponents(int16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, const TimeZone &timeZone)
Factory method using separated date, time, and time zone fields.
int16_t year() const
Return the year.
const LocalDateTime & localDateTime() const
Return the LocalDateTime of the components.
uint8_t hour() const
Return the hour.
const LocalDateTime & localDateTime() const
Return the LocalDateTime.
int8_t compareTo(const ZonedDateTime &that) const
Compare this ZonedDateTime with another ZonedDateTime, and return (<0, 0, >0) according to whether th...
The date (year, month, day), time (hour, minute, second) and offset from UTC (timeOffset).
uint8_t month() const
Return the month with January=1, December=12.
acetime_t toEpochSeconds() const
Return seconds since AceTime epoch (2000-01-01 00:00:00Z), taking into account the offset zone...
bool isError() const
Return true if any component indicates an error condition.
A thin wrapper that represents a time offset from a reference point, usually 00:00 at UTC...
static ZonedDateTime forEpochSeconds(acetime_t epochSeconds, const TimeZone &timeZone)
Factory method.
static TimeZone forTimeOffset(TimeOffset stdOffset, TimeOffset dstOffset=TimeOffset())
Factory method to create from a UTC offset and an optional DST offset.
Class that describes a time zone.
The date (year, month, day), time (hour, minute, second), and a timeZone representing an instant in t...
void printTo(Print &printer) const
Print ZonedDateTime to 'printer'.
acetime_t toEpochDays() const
Return number of whole days since AceTime epoch (2000-01-01 00:00:00Z), taking into account the time ...
ZonedDateTime convertToTimeZone(const TimeZone &timeZone) const
Create a ZonedDateTime in a different time zone (with the same epochSeconds).
void minute(uint8_t minute)
Set the minute.
static ZonedDateTime forDateString(const __FlashStringHelper *dateString)
Factory method.
static ZonedDateTime forUnixSeconds(acetime_t unixSeconds, const TimeZone &timeZone)
Factory method to create a ZonedDateTime using the number of seconds from Unix epoch.
int8_t yearTiny() const
Return the single-byte year offset from year 2000.
friend bool operator==(const ZonedDateTime &a, const ZonedDateTime &b)
Return true if two ZonedDateTime objects are equal in all components.
uint8_t second() const
Return the second.
uint8_t day() const
Return the day of the month.
void timeZone(const TimeZone &timeZone)
Set the time zone.
uint8_t minute() const
Return the minute.
ZonedDateTime()
Default constructor.
bool isError() const
Return true if any component indicates an error condition.
void month(uint8_t month)
Set the month.
static OffsetDateTime forError()
Factory method that returns an instance whose isError() is true.
Class that holds the date-time as the components (year, month, day, hour, minute, second) without reg...
TimeOffset getUtcOffset(acetime_t epochSeconds) const
Return the total UTC offset at epochSeconds, including DST offset.
int16_t year() const
Return the year.
static OffsetDateTime forDateString(const char *dateString)
Factory method.