AceTime  0.7
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 supports for all zones defined by the TZ Database. 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
 
class ::TransitionStorageTest_findTransitionForDateTime
 
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 supports for all zones defined by the TZ Database.

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 the initial Python implementation of this class, which got translated into C++.

Currently (as of v0.7), the underlying zoneinfo files (extended::ZoneInfo, etc) store the UTC and DST offsets of a timezone as a single signed byte in 15-minute increments. This is sufficient to accurate describe all time zones from the year 2000 until 2050. The AT and UNTIL transition times are stored using a 1-minute resolution, which correctly handles the 5 timezones whose DST transition times occur at 00:01. Those zones are:

Not thread-safe.

Definition at line 658 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 664 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.

Returns an empty string ("") if an error occurs. The returned pointer points to a char buffer that could get overriden by subsequent method calls to this object. The pointer must not be stored permanently, it should be used as soon as possible (e.g. printed out).

This is an experimental method that has not been tested thoroughly. Use with caution.

Implements ace_time::ZoneProcessor.

Definition at line 693 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 686 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 700 of file ExtendedZoneProcessor.h.

◆ getTransitionHighWater()

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

Get the TransitionStorage high water mark.

For debugging.

Definition at line 781 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 676 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 674 of file ExtendedZoneProcessor.h.

◆ getZoneInfo()

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

Return the underlying ZoneInfo.

Implements ace_time::ZoneProcessor.

Definition at line 670 of file ExtendedZoneProcessor.h.

◆ log()

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

Used only for debugging.

Definition at line 763 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 29 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 25 of file ExtendedZoneProcessor.cpp.

◆ resetTransitionHighWater()

void ace_time::ExtendedZoneProcessor::resetTransitionHighWater ( )
inline

Reset the TransitionStorage high water mark.

For debugging.

Definition at line 776 of file ExtendedZoneProcessor.h.


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