AceTime  0.5
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::ExtendedZoneProcessor Class Reference

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>

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

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...
 
- Public Member Functions inherited from ace_time::ZoneProcessor
uint8_t getType () const
 Return the kTypeXxx of the current instance. More...
 

Friends

class ::ExtendedZoneProcessorTest_compareEraToYearMonth
 
class ::ExtendedZoneProcessorTest_compareEraToYearMonth2
 
class ::ExtendedZoneProcessorTest_createMatch
 
class ::ExtendedZoneProcessorTest_findMatches_simple
 
class ::ExtendedZoneProcessorTest_findMatches_named
 
class ::ExtendedZoneProcessorTest_findCandidateTransitions
 
class ::ExtendedZoneProcessorTest_findTransitionsFromNamedMatch
 
class ::ExtendedZoneProcessorTest_getTransitionTime
 
class ::ExtendedZoneProcessorTest_createTransitionForYear
 
class ::ExtendedZoneProcessorTest_normalizeDateTuple
 
class ::ExtendedZoneProcessorTest_expandDateTuple
 
class ::ExtendedZoneProcessorTest_calcInteriorYears
 
class ::ExtendedZoneProcessorTest_getMostRecentPriorYear
 
class ::ExtendedZoneProcessorTest_compareTransitionToMatchFuzzy
 
class ::ExtendedZoneProcessorTest_compareTransitionToMatch
 
class ::ExtendedZoneProcessorTest_processActiveTransition
 
class ::ExtendedZoneProcessorTest_fixTransitionTimes_generateStartUntilTimes
 
class ::ExtendedZoneProcessorTest_createAbbreviation
 
class ::ExtendedZoneProcessorTest_setZoneInfo
 
template<uint8_t SIZE, uint8_t TYPE, typename ZS , typename ZI , typename ZIB >
class ZoneProcessorCacheImpl
 

Additional Inherited Members

- Static Public Attributes inherited from ace_time::ZoneProcessor
static const uint8_t kTypeBasic = 2
 Indicate BasicZoneProcessor. More...
 
static const uint8_t kTypeExtended = 3
 Indicate ExtendedZoneProcessor. More...
 
- Protected Member Functions inherited from ace_time::ZoneProcessor
 ZoneProcessor (const ZoneProcessor &)=delete
 
ZoneProcessoroperator= (const ZoneProcessor &)=delete
 
 ZoneProcessor (uint8_t type)
 Constructor. More...
 
- Protected Attributes inherited from ace_time::ZoneProcessor
uint8_t mType
 

Detailed Description

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 644 of file ExtendedZoneProcessor.h.

Constructor & Destructor Documentation

◆ ExtendedZoneProcessor()

ace_time::ExtendedZoneProcessor::ExtendedZoneProcessor ( const extended::ZoneInfo zoneInfo = nullptr)
inlineexplicit

Constructor.

The ZoneInfo is given only for unit tests.

Parameters
zoneInfopointer to a ZoneInfo.

Definition at line 650 of file ExtendedZoneProcessor.h.

Member Function Documentation

◆ getAbbrev()

const char* ace_time::ExtendedZoneProcessor::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::ZoneProcessor.

Definition at line 679 of file ExtendedZoneProcessor.h.

◆ getDeltaOffset()

TimeOffset ace_time::ExtendedZoneProcessor::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::ZoneProcessor.

Definition at line 672 of file ExtendedZoneProcessor.h.

◆ getOffsetDateTime()

OffsetDateTime ace_time::ExtendedZoneProcessor::getOffsetDateTime ( const LocalDateTime ldt) const
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 686 of file ExtendedZoneProcessor.h.

◆ getTransitionHighWater()

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

Get the TransitionStorage high water mark.

For debugging.

Definition at line 745 of file ExtendedZoneProcessor.h.

◆ getUtcOffset()

TimeOffset ace_time::ExtendedZoneProcessor::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::ZoneProcessor.

Definition at line 662 of file ExtendedZoneProcessor.h.

◆ getZoneId()

uint32_t ace_time::ExtendedZoneProcessor::getZoneId ( ) const
inlineoverridevirtual

Return the unique stable zoneId.

Implements ace_time::ZoneProcessor.

Definition at line 660 of file ExtendedZoneProcessor.h.

◆ getZoneInfo()

const void* ace_time::ExtendedZoneProcessor::getZoneInfo ( ) const
inlineoverridevirtual

Return the underlying ZoneInfo.

Implements ace_time::ZoneProcessor.

Definition at line 656 of file ExtendedZoneProcessor.h.

◆ log()

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

Used only for debugging.

Definition at line 727 of file ExtendedZoneProcessor.h.

◆ printShortTo()

void ace_time::ExtendedZoneProcessor::printShortTo ( Print &  printer) const
overridevirtual

Print a short human-readable identifier (e.g.

"Los_Angeles")

Implements ace_time::ZoneProcessor.

Definition at line 28 of file ExtendedZoneProcessor.cpp.

◆ printTo()

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

Print a human-readable identifier (e.g.

"America/Los_Angeles").

Implements ace_time::ZoneProcessor.

Definition at line 24 of file ExtendedZoneProcessor.cpp.

◆ resetTransitionHighWater()

void ace_time::ExtendedZoneProcessor::resetTransitionHighWater ( )
inline

Reset the TransitionStorage high water mark.

For debugging.

Definition at line 740 of file ExtendedZoneProcessor.h.


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