AceTime  3.0.0
Date and time classes for Arduino that support timezones from the TZ Database.
Public Attributes | List of all members
ace_time::ZoneInfoLow::ZoneEra Struct Reference

An entry in ZoneInfo which describes which ZonePolicy was being followed during a particular time period. More...

#include <ZoneInfoLow.h>

Collaboration diagram for ace_time::ZoneInfoLow::ZoneEra:
Collaboration graph
[legend]

Public Attributes

const ZonePolicy *const zonePolicy
 Zone policy, determined by the RULES column. More...
 
const char *const format
 Zone abbreviations (e.g. More...
 
int8_t const offsetCode
 UTC offset in 15 min increments. More...
 
uint8_t const deltaCode
 This is a composite of two 4-bit fields: More...
 
int8_t const untilYear
 Era is valid until currentTime < untilYear. More...
 
uint8_t const untilMonth
 The month field in UNTIL (1-12). More...
 
uint8_t const untilDay
 The day field in UNTIL (1-31). More...
 
uint8_t const untilTimeCode
 The time field of UNTIL field in 15-minute increments. More...
 
uint8_t const untilTimeModifier
 The untilTimeModifier is a packed field containing 2 pieces of info: More...
 

Detailed Description

An entry in ZoneInfo which describes which ZonePolicy was being followed during a particular time period.

Corresponds to one line of the ZONE record in the TZ Database file ending with an UNTIL field. The ZonePolicy is determined by the RULES column in the TZ Database file.

There are 2 types of ZoneEra: 1) zonePolicy == nullptr. Then ZoneEra.deltaCode determines the additional offset from offsetCode. A value of '-' in the TZ Database file is stored as 0. 2) zonePolicy != nullptr. Then the ZoneRule.deltaCode offset is given by the ZoneRule.deltaCode which matches the time instant of interest.

Definition at line 231 of file ZoneInfoLow.h.

Member Data Documentation

◆ deltaCode

uint8_t const ace_time::ZoneInfoLow::ZoneEra::deltaCode

This is a composite of two 4-bit fields:

  • The upper 4-bits is an unsigned integer from 0 to 14 that represents the one-minute remainder from the offsetCode. This allows us to capture STDOFF offsets in 1-minute resolution.
  • The lower 4-bits is an unsigned integer that holds (originalDeltaCode
    • 4). The originalDeltaCode is defined if zonePolicy is nullptr, which indicates that the DST offset is defined by the RULES column in 'hh:mm' format. If the 'RULES' column is '-', then the originalDeltaCode is 0. With 4-bits of information, and the 1h shift, this allows us to represent DST offsets from -1:00 to +2:45, in 15-minute increments.

The ZoneEraBroker::deltaMinutes() and ZoneEraBroker::offsetMinutes() methods know how to convert offsetCode and deltaCode into the appropriate minutes.

Definition at line 284 of file ZoneInfoLow.h.

◆ format

const char* const ace_time::ZoneInfoLow::ZoneEra::format

Zone abbreviations (e.g.

PST, EST) determined by the FORMAT column. It has 4 encodings in the TZ DB files:

1) A fixed string, e.g. "GMT". 2) Two strings separated by a '/', e.g. "-03/-02" indicating "{std}/{dst}" options. 3) A single string with a substitution, e.g. "E%sT", where the "%s" is replaced by the LETTER value from the ZoneRule. 4) An empty string representing the "%z" format.

BasicZoneProcessor supports only a single letter subsitution from LETTER, but ExtendedZoneProcessor supports substituting multi-character strings (e.g. "CAT", "DD", "+00").

The TZ DB files use 's' to indicate the substitution, but for simplicity, AceTime replaces the "%s" with just a '' character with no loss of functionality. This also makes the string-replacement code a little simpler. For example, 'EsT' is stored as 'ET', and the LETTER substitution is performed on the '' character.

This field will never be a 'nullptr' because the AceTimeTools compiler always generates a ZoneEra entry with a non-null format.

Definition at line 262 of file ZoneInfoLow.h.

◆ offsetCode

int8_t const ace_time::ZoneInfoLow::ZoneEra::offsetCode

UTC offset in 15 min increments.

Determined by the STDOFF column.

Definition at line 265 of file ZoneInfoLow.h.

◆ untilDay

uint8_t const ace_time::ZoneInfoLow::ZoneEra::untilDay

The day field in UNTIL (1-31).

Will never be 0. Also, there's no need for untilDayOfWeek, because the database generator will resolve the exact day of month based on the known year and month.

Definition at line 299 of file ZoneInfoLow.h.

◆ untilMonth

uint8_t const ace_time::ZoneInfoLow::ZoneEra::untilMonth

The month field in UNTIL (1-12).

Will never be 0.

Definition at line 292 of file ZoneInfoLow.h.

◆ untilTimeCode

uint8_t const ace_time::ZoneInfoLow::ZoneEra::untilTimeCode

The time field of UNTIL field in 15-minute increments.

A range of 00:00 to 25:00 corresponds to 0-100.

Definition at line 305 of file ZoneInfoLow.h.

◆ untilTimeModifier

uint8_t const ace_time::ZoneInfoLow::ZoneEra::untilTimeModifier

The untilTimeModifier is a packed field containing 2 pieces of info:

  • The upper 4 bits represent the UNTIL time suffix: 'w', 's' or 'u', represented by kSuffixW, kSuffixS and kSuffixU.
  • The lower 4 bits represent the remaining 0-14 minutes of the UNTIL field after truncation into untilTimeCode. In other words, the full UNTIL field in one-minute resolution is (15 * untilTimeCode + (untilTimeModifier & 0x0f)).

Definition at line 317 of file ZoneInfoLow.h.

◆ untilYear

int8_t const ace_time::ZoneInfoLow::ZoneEra::untilYear

Era is valid until currentTime < untilYear.

Comes from the UNTIL column.

Definition at line 289 of file ZoneInfoLow.h.

◆ zonePolicy

const ZonePolicy* const ace_time::ZoneInfoLow::ZoneEra::zonePolicy

Zone policy, determined by the RULES column.

Set to nullptr if the RULES column is '-' or an explicit DST shift in the form of 'hh:mm'.

Definition at line 236 of file ZoneInfoLow.h.


The documentation for this struct was generated from the following file: