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.
Public Member Functions | Friends | List of all members
ace_time::ExtendedZoneSpecifier Class Reference

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>

Inheritance diagram for ace_time::ExtendedZoneSpecifier:
Inheritance graph
[legend]
Collaboration diagram for ace_time::ExtendedZoneSpecifier:
Collaboration graph
[legend]

Public Member Functions

 ExtendedZoneSpecifier (const extended::ZoneInfo *zoneInfo)
 Constructor. More...
 
const extended::ZoneInfogetZoneInfo () 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...
 
- Public Member Functions inherited from ace_time::ZoneSpecifier
uint8_t getType () const
 Return the kTypeXxx of the current instance. More...
 

Friends

class ::ExtendedZoneSpecifierTest_compareEraToYearMonth
 
class ::ExtendedZoneSpecifierTest_createMatch
 
class ::ExtendedZoneSpecifierTest_findMatches_simple
 
class ::ExtendedZoneSpecifierTest_findMatches_named
 
class ::ExtendedZoneSpecifierTest_findCandidateTransitions
 
class ::ExtendedZoneSpecifierTest_findTransitionsFromNamedMatch
 
class ::ExtendedZoneSpecifierTest_getTransitionTime
 
class ::ExtendedZoneSpecifierTest_createTransitionForYear
 
class ::ExtendedZoneSpecifierTest_normalizeDateTuple
 
class ::ExtendedZoneSpecifierTest_expandDateTuple
 
class ::ExtendedZoneSpecifierTest_calcInteriorYears
 
class ::ExtendedZoneSpecifierTest_getMostRecentPriorYear
 
class ::ExtendedZoneSpecifierTest_compareTransitionToMatchFuzzy
 
class ::ExtendedZoneSpecifierTest_compareTransitionToMatch
 
class ::ExtendedZoneSpecifierTest_processActiveTransition
 
class ::ExtendedZoneSpecifierTest_fixTransitionTimes_generateStartUntilTimes
 
class ::ExtendedZoneSpecifierTest_createAbbreviation
 

Additional Inherited Members

- Static Public Attributes inherited from ace_time::ZoneSpecifier
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...
 
- Protected Member Functions inherited from ace_time::ZoneSpecifier
 ZoneSpecifier (const ZoneSpecifier &)=default
 
ZoneSpecifieroperator= (const ZoneSpecifier &)=default
 
 ZoneSpecifier (uint8_t type)
 Constructor. More...
 
- Protected Attributes inherited from ace_time::ZoneSpecifier
uint8_t mType
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ExtendedZoneSpecifier()

ace_time::ExtendedZoneSpecifier::ExtendedZoneSpecifier ( const extended::ZoneInfo zoneInfo)
inlineexplicit

Constructor.

Parameters
zoneInfopointer to a ZoneInfo. Must not be nullptr.

Definition at line 636 of file ExtendedZoneSpecifier.h.

Member Function Documentation

◆ getAbbrev()

const char* ace_time::ExtendedZoneSpecifier::getAbbrev ( acetime_t  epochSeconds) const
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.

◆ getDeltaOffset()

TimeOffset ace_time::ExtendedZoneSpecifier::getDeltaOffset ( acetime_t  epochSeconds) const
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.

◆ getOffsetDateTime()

OffsetDateTime ace_time::ExtendedZoneSpecifier::getOffsetDateTime ( const LocalDateTime ldt) const
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.

◆ getTransitionHighWater()

uint8_t ace_time::ExtendedZoneSpecifier::getTransitionHighWater ( ) const
inline

Get the TransitionStorage high water mark.

For debugging.

Definition at line 725 of file ExtendedZoneSpecifier.h.

◆ getUtcOffset()

TimeOffset ace_time::ExtendedZoneSpecifier::getUtcOffset ( acetime_t  epochSeconds) const
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.

◆ getZoneInfo()

const extended::ZoneInfo* ace_time::ExtendedZoneSpecifier::getZoneInfo ( ) const
inline

Return the underlying ZoneInfo.

Definition at line 641 of file ExtendedZoneSpecifier.h.

◆ log()

void ace_time::ExtendedZoneSpecifier::log ( ) const
inline

Used only for debugging.

Definition at line 707 of file ExtendedZoneSpecifier.h.

◆ printTo()

void ace_time::ExtendedZoneSpecifier::printTo ( Print &  printer) const
overridevirtual

Print the TD database zone identifier e.g "America/Los_Angeles".

Implements ace_time::ZoneSpecifier.

Definition at line 18 of file ExtendedZoneSpecifier.cpp.

◆ resetTransitionHighWater()

void ace_time::ExtendedZoneSpecifier::resetTransitionHighWater ( )
inline

Reset the TransitionStorage high water mark.

For debugging.

Definition at line 720 of file ExtendedZoneSpecifier.h.


The documentation for this class was generated from the following files: