AceTime  1.0
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 Attributes | Static Public Attributes | List of all members
ace_time::extended::ZoneEra Struct Reference

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

#include <ZoneInfo.h>

Collaboration diagram for ace_time::extended::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...
 
int8_t const deltaCode
 If zonePolicy is nullptr, then this indicates the DST offset in 15 minute increments as defined by the RULES column in 'hh:mm' format. More...
 
int8_t const untilYearTiny
 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...
 

Static Public Attributes

static const int8_t kMaxUntilYearTiny = ZoneRule::kMaxYearTiny + 1
 The maximum value of untilYearTiny. 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 deltaCode determines the additional offset from offsetCode. A value of '-' in the TZ Database file is stored as 0. 2) zonePolicy != nullptr. Then the deltaCode offset is given by the ZoneRule.deltaCode of the ZoneRule which matches the time instant of interest.

Definition at line 20 of file ZoneInfo.h.

Member Data Documentation

◆ deltaCode

int8_t const ace_time::extended::ZoneEra::deltaCode

If zonePolicy is nullptr, then this indicates the DST offset in 15 minute increments as defined by the RULES column in 'hh:mm' format.

If the 'RULES' column is '-', then the deltaCode is 0.

If the '–scope extended' flag is given to tzcompiler.py, the 'deltaCode` should be interpreted as a uint8_t field, composed 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). This allows us to represent DST offsets from -1:00 to +2:45, in 15-minute increments.

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

Definition at line 59 of file ZoneInfo.h.

◆ format

const char* const ace_time::extended::ZoneEra::format

Zone abbreviations (e.g.

PST, EST) determined by the FORMAT column. Only a single letter subsitution is supported so that 's' is changed to just ''. For example, 'EST' is stored as 'ET', and the LETTER substitution is performed on the '' character.

Definition at line 36 of file ZoneInfo.h.

◆ kMaxUntilYearTiny

const int8_t ace_time::extended::ZoneEra::kMaxUntilYearTiny = ZoneRule::kMaxYearTiny + 1
static

The maximum value of untilYearTiny.

Definition at line 22 of file ZoneInfo.h.

◆ offsetCode

int8_t const ace_time::extended::ZoneEra::offsetCode

UTC offset in 15 min increments.

Determined by the STDOFF column.

Definition at line 39 of file ZoneInfo.h.

◆ untilDay

uint8_t const ace_time::extended::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 75 of file ZoneInfo.h.

◆ untilMonth

uint8_t const ace_time::extended::ZoneEra::untilMonth

The month field in UNTIL (1-12).

Will never be 0.

Definition at line 68 of file ZoneInfo.h.

◆ untilTimeCode

uint8_t const ace_time::extended::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 81 of file ZoneInfo.h.

◆ untilTimeModifier

uint8_t const ace_time::extended::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 93 of file ZoneInfo.h.

◆ untilYearTiny

int8_t const ace_time::extended::ZoneEra::untilYearTiny

Era is valid until currentTime < untilYear.

Stored as (year - 2000) in a single byte to save space. Comes from the UNTIL column.

Definition at line 65 of file ZoneInfo.h.

◆ zonePolicy

const ZonePolicy* const ace_time::extended::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 28 of file ZoneInfo.h.


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