AceTime
0.6.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.
|
An implementation of ZoneProcessor that works for all zones defined by the TZ Database (with some zones suffering a slight loss of accurancy described below). More...
#include <ExtendedZoneProcessor.h>
Public Member Functions | |
ExtendedZoneProcessor (const extended::ZoneInfo *zoneInfo=nullptr) | |
Constructor. More... | |
const void * | getZoneInfo () const override |
Return the underlying ZoneInfo. More... | |
uint32_t | getZoneId () const override |
Return the unique stable zoneId. 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 ZoneProcessor. More... | |
void | printTo (Print &printer) const override |
Print a human-readable identifier (e.g. More... | |
void | printShortTo (Print &printer) const override |
Print a short human-readable identifier (e.g. 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 | kTypeBasic = 2 |
Indicate BasicZoneProcessor. More... | |
static const uint8_t | kTypeExtended = 3 |
Indicate ExtendedZoneProcessor. More... | |
![]() | |
ZoneProcessor (const ZoneProcessor &)=delete | |
ZoneProcessor & | operator= (const ZoneProcessor &)=delete |
ZoneProcessor (uint8_t type) | |
Constructor. More... | |
![]() | |
uint8_t | mType |
An implementation of ZoneProcessor 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 BasicZoneProcessor, 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 654 of file ExtendedZoneProcessor.h.
|
inlineexplicit |
Constructor.
The ZoneInfo is given only for unit tests.
zoneInfo | pointer to a ZoneInfo. |
Definition at line 660 of file ExtendedZoneProcessor.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::ZoneProcessor.
Definition at line 689 of file ExtendedZoneProcessor.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::ZoneProcessor.
Definition at line 682 of file ExtendedZoneProcessor.h.
|
inlineoverridevirtual |
Return the best estimate of the OffsetDateTime at the given LocalDateTime for the timezone of the current ZoneProcessor.
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::ZoneProcessor.
Definition at line 696 of file ExtendedZoneProcessor.h.
|
inline |
Get the TransitionStorage high water mark.
For debugging.
Definition at line 755 of file ExtendedZoneProcessor.h.
|
inlineoverridevirtual |
Return the total UTC offset at epochSeconds, including DST offset.
Returns TimeOffset::forError() if an error occurs.
Implements ace_time::ZoneProcessor.
Definition at line 672 of file ExtendedZoneProcessor.h.
|
inlineoverridevirtual |
Return the unique stable zoneId.
Implements ace_time::ZoneProcessor.
Definition at line 670 of file ExtendedZoneProcessor.h.
|
inlineoverridevirtual |
Return the underlying ZoneInfo.
Implements ace_time::ZoneProcessor.
Definition at line 666 of file ExtendedZoneProcessor.h.
|
inline |
Used only for debugging.
Definition at line 737 of file ExtendedZoneProcessor.h.
|
overridevirtual |
Print a short human-readable identifier (e.g.
"Los_Angeles")
Implements ace_time::ZoneProcessor.
Definition at line 29 of file ExtendedZoneProcessor.cpp.
|
overridevirtual |
Print a human-readable identifier (e.g.
"America/Los_Angeles").
Implements ace_time::ZoneProcessor.
Definition at line 25 of file ExtendedZoneProcessor.cpp.
|
inline |
Reset the TransitionStorage high water mark.
For debugging.
Definition at line 750 of file ExtendedZoneProcessor.h.