AceTime
0.3
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.
|
An implementation of ZoneSpecifier that works for all zones defined by the TZ Database (with some zones suffering a slight loss of accurancy described below). More...
#include <ExtendedZoneSpecifier.h>
Public Member Functions | |
ExtendedZoneSpecifier (const extended::ZoneInfo *zoneInfo) | |
Constructor. More... | |
const extended::ZoneInfo * | getZoneInfo () const |
Return the underlying ZoneInfo. More... | |
TimeOffset | getUtcOffset (acetime_t epochSeconds) const override |
Return the total UTC offset at epochSeconds, including DST offset. More... | |
TimeOffset | getDeltaOffset (acetime_t epochSeconds) const override |
Return the DST delta offset at epochSeconds. More... | |
const char * | getAbbrev (acetime_t epochSeconds) const override |
Return the time zone abbreviation at epochSeconds. More... | |
OffsetDateTime | getOffsetDateTime (const LocalDateTime &ldt) const override |
Return the best estimate of the OffsetDateTime at the given LocalDateTime for the timezone of the current ZoneSpecifier. More... | |
void | printTo (Print &printer) const override |
Print the TD database zone identifier e.g "America/Los_Angeles". More... | |
void | log () const |
Used only for debugging. More... | |
void | resetTransitionHighWater () |
Reset the TransitionStorage high water mark. More... | |
uint8_t | getTransitionHighWater () const |
Get the TransitionStorage high water mark. More... | |
![]() | |
uint8_t | getType () const |
Return the kTypeXxx of the current instance. More... | |
Additional Inherited Members | |
![]() | |
static const uint8_t | kTypeManual = 1 |
Indicate ManualZoneSpecifier. More... | |
static const uint8_t | kTypeBasic = 2 |
Indicate BasicZoneSpecifier. More... | |
static const uint8_t | kTypeExtended = 3 |
Indicate ExtendedZoneSpecifier. More... | |
![]() | |
ZoneSpecifier (const ZoneSpecifier &)=default | |
ZoneSpecifier & | operator= (const ZoneSpecifier &)=default |
ZoneSpecifier (uint8_t type) | |
Constructor. More... | |
![]() | |
uint8_t | mType |
An implementation of ZoneSpecifier that works for all zones defined by the TZ Database (with some zones suffering a slight loss of accurancy described below).
The supported zones are defined in the zonedbx/zone_infos.h header file. The constructor expects a pointer to one of the ZoneInfo structures declared in the zonedbx/zone_infos.h file. The zone_specifier.py file is a Python implementation of this class.
Just like BasicZoneSpecifier, UTC offsets are stored as a single signed byte in units of 15-minute increments to save memory. Fortunately, all current (year 2019) time zones have DST offsets at 15-minute boundaries. But in addition to the DST offset, this class uses a single signed byte to store the time at which a timezone changes the DST offset.
There are current 5 timezones whose DST transition times are at 00:01 (i.e. 1 minute after midnight). Those transition times are truncated down by tzcompiler.py to the nearest 15-minutes, in other words to 00:00. Those zones are:
Not thread-safe.
Definition at line 630 of file ExtendedZoneSpecifier.h.
|
inlineexplicit |
Constructor.
zoneInfo | pointer to a ZoneInfo. Must not be nullptr. |
Definition at line 636 of file ExtendedZoneSpecifier.h.
|
inlineoverridevirtual |
Return the time zone abbreviation at epochSeconds.
This is an experimental method that has not been tested thoroughly. Use with caution. Returns an empty string ("") if an error occurs.
Implements ace_time::ZoneSpecifier.
Definition at line 660 of file ExtendedZoneSpecifier.h.
|
inlineoverridevirtual |
Return the DST delta offset at epochSeconds.
This is an experimental method that has not been tested thoroughly. Use with caution. Returns TimeOffset::forError() if an error occurs.
Implements ace_time::ZoneSpecifier.
Definition at line 653 of file ExtendedZoneSpecifier.h.
|
inlineoverridevirtual |
Return the best estimate of the OffsetDateTime at the given LocalDateTime for the timezone of the current ZoneSpecifier.
Returns OffsetDateTime::forError() if an error occurs, for example, if the LocalDateTime is outside of the support date range of the underlying ZoneInfo files.
Implements ace_time::ZoneSpecifier.
Definition at line 667 of file ExtendedZoneSpecifier.h.
|
inline |
Get the TransitionStorage high water mark.
For debugging.
Definition at line 725 of file ExtendedZoneSpecifier.h.
|
inlineoverridevirtual |
Return the total UTC offset at epochSeconds, including DST offset.
Returns TimeOffset::forError() if an error occurs.
Implements ace_time::ZoneSpecifier.
Definition at line 643 of file ExtendedZoneSpecifier.h.
|
inline |
Return the underlying ZoneInfo.
Definition at line 641 of file ExtendedZoneSpecifier.h.
|
inline |
Used only for debugging.
Definition at line 707 of file ExtendedZoneSpecifier.h.
|
overridevirtual |
Print the TD database zone identifier e.g "America/Los_Angeles".
Implements ace_time::ZoneSpecifier.
Definition at line 18 of file ExtendedZoneSpecifier.cpp.
|
inline |
Reset the TransitionStorage high water mark.
For debugging.
Definition at line 720 of file ExtendedZoneSpecifier.h.