AceTime 2.4.0 Date and time classes for Arduino that support timezones from the TZ Database.

ZoneInfoMid.h
Go to the documentation of this file.
1 /*
2 * MIT License
3 * Copyright (c) 2018 Brian T. Park
4 */
5
6 #ifndef ACE_TIME_ZONE_INFO_MID_H
7 #define ACE_TIME_ZONE_INFO_MID_H
8
9 #include <stdint.h>
10
33 namespace ace_time{
34 namespace zoneinfomid {
35
40 template<typename S>
41 struct ZoneContext {
48 static const int16_t kMaxUntilYear = 32767;
49
56 static const int16_t kMaxYear = kMaxUntilYear - 1;
57
66 static const int16_t kMinYear = -32767;
67
69 static const uint8_t kSuffixW = 0x00;
70
72 static const uint8_t kSuffixS = 0x10;
73
75 static const uint8_t kSuffixU = 0x20;
76
78 int16_t const startYear;
79
81 int16_t const untilYear;
82
84 int16_t const startYearAccurate;
85
87 int16_t const untilYearAccurate;
88
90 int16_t const baseYear;
91
93 int16_t const maxTransitions;
94
96 const char* const tzVersion;
97
99 uint8_t const numFragments;
100
102 uint8_t const numLetters;;
103
105 const char* const* const fragments;
106
108 const char* const* const letters;
109 };
110
116 template<typename S>
117 struct ZoneRule {
119 int16_t const fromYear;
120
122 int16_t const toYear;
123
125 uint8_t const inMonth;
126
137 uint8_t const onDayOfWeek;
138
143 int8_t const onDayOfMonth;
144
149 uint8_t const atTimeCode;
150
160 uint8_t const atTimeModifier;
161
172 uint8_t const deltaCode;
173
186 uint8_t const letterIndex;
187 };
188
195 template<typename S>
196 struct ZonePolicy {
197 const ZoneRule<S>* const rules;
198 uint8_t const numRules;
199 };
200
213 template<typename S>
214 struct ZoneEra {
219 const ZonePolicy<S>* const zonePolicy;
220
245 const char* const format;
246
248 int8_t const offsetCode;
249
267 uint8_t const deltaCode;
268
272 int16_t const untilYear;
273
275 uint8_t const untilMonth;
276
282 uint8_t const untilDay;
283
288 uint8_t const untilTimeCode;
289
300 uint8_t const untilTimeModifier;
301 };
302
307 template<typename S, typename ZC>
308 struct ZoneInfo {
310 const char* const name;
311
317 uint32_t const zoneId;
318
320 const ZC* const zoneContext;
321
337 uint8_t const numEras;
338
343 const ZoneEra<S>* const eras;
344
346 const ZoneInfo* const targetInfo;
347 };
348
349 }
350 }
351
352 #endif
ace_time::zoneinfomid::ZoneContext
Metadata about the zone database.
Definition: ZoneInfoMid.h:41
ace_time::zoneinfomid::ZoneContext::kSuffixU
static const uint8_t kSuffixU
Represents 'u' or UTC time.
Definition: ZoneInfoMid.h:75
ace_time::zoneinfomid::ZoneContext::baseYear
int16_t const baseYear
Base year for tiny years.
Definition: ZoneInfoMid.h:90
ace_time::zoneinfomid::ZoneContext::untilYearAccurate
int16_t const untilYearAccurate
Until year of accurate transitions.
Definition: ZoneInfoMid.h:87
ace_time::zoneinfomid::ZoneContext::tzVersion
const char *const tzVersion
TZ Database version which generated the zone info.
Definition: ZoneInfoMid.h:96
ace_time::zoneinfomid::ZoneContext::startYear
int16_t const startYear
Start year of the zone files as requested.
Definition: ZoneInfoMid.h:78
ace_time::zoneinfomid::ZoneContext::letters
const char *const *const letters
Zone Rule letters list.
Definition: ZoneInfoMid.h:108
ace_time::zoneinfomid::ZoneContext::fragments
const char *const *const fragments
Zone Name fragment list.
Definition: ZoneInfoMid.h:102
ace_time::zoneinfomid::ZoneContext::kMaxUntilYear
static const int16_t kMaxUntilYear
The maximum value of untilYear.
Definition: ZoneInfoMid.h:48
ace_time::zoneinfomid::ZoneContext::kMinYear
static const int16_t kMinYear
The minimum value of fromYear and toYear.
Definition: ZoneInfoMid.h:66
ace_time::zoneinfomid::ZoneContext::startYearAccurate
int16_t const startYearAccurate
Start year of accurate transitions.
Definition: ZoneInfoMid.h:84
ace_time::zoneinfomid::ZoneContext::maxTransitions
int16_t const maxTransitions
Max number of transitions required in TransitionStorage.
Definition: ZoneInfoMid.h:93
ace_time::zoneinfomid::ZoneContext::kSuffixS
static const uint8_t kSuffixS
Represents 's' or standard time.
Definition: ZoneInfoMid.h:72
ace_time::zoneinfomid::ZoneContext::kSuffixW
static const uint8_t kSuffixW
Represents 'w' or wall time.
Definition: ZoneInfoMid.h:69
ace_time::zoneinfomid::ZoneContext::kMaxYear
static const int16_t kMaxYear
The maximum value fromYear and toYear.
Definition: ZoneInfoMid.h:56
ace_time::zoneinfomid::ZoneContext::numLetters
uint8_t const numLetters
Number of fragments.
Definition: ZoneInfoMid.h:102
ace_time::zoneinfomid::ZoneContext::untilYear
int16_t const untilYear
Until year of the zone files as requested.
Definition: ZoneInfoMid.h:81
ace_time::zoneinfomid::ZoneContext::numFragments
uint8_t const numFragments
Number of fragments.
Definition: ZoneInfoMid.h:99
ace_time::zoneinfomid::ZoneEra
An entry in ZoneInfo which describes which ZonePolicy was being followed during a particular time per...
Definition: ZoneInfoMid.h:214
ace_time::zoneinfomid::ZoneEra::untilTimeModifier
uint8_t const untilTimeModifier
The untilTimeModifier is a packed field containing 2 pieces of info:
Definition: ZoneInfoMid.h:300
ace_time::zoneinfomid::ZoneEra::untilMonth
uint8_t const untilMonth
The month field in UNTIL (1-12).
Definition: ZoneInfoMid.h:275
ace_time::zoneinfomid::ZoneEra::untilTimeCode
uint8_t const untilTimeCode
The time field of UNTIL field in 15-minute increments.
Definition: ZoneInfoMid.h:288
ace_time::zoneinfomid::ZoneEra::untilYear
int16_t const untilYear
Era is valid until currentTime < untilYear.
Definition: ZoneInfoMid.h:272
ace_time::zoneinfomid::ZoneEra::deltaCode
uint8_t const deltaCode
This is a composite of two 4-bit fields:
Definition: ZoneInfoMid.h:267
ace_time::zoneinfomid::ZoneEra::zonePolicy
const ZonePolicy< S > *const zonePolicy
Zone policy, determined by the RULES column.
Definition: ZoneInfoMid.h:219
ace_time::zoneinfomid::ZoneEra::format
const char *const format
Zone abbreviations (e.g.
Definition: ZoneInfoMid.h:245
ace_time::zoneinfomid::ZoneEra::offsetCode
int8_t const offsetCode
UTC offset in 15 min increments.
Definition: ZoneInfoMid.h:248
ace_time::zoneinfomid::ZoneEra::untilDay
uint8_t const untilDay
The day field in UNTIL (1-31).
Definition: ZoneInfoMid.h:282
ace_time::zoneinfomid::ZoneInfo
Representation of a given time zone, implemented as an array of ZoneEra records.
Definition: ZoneInfoMid.h:308
ace_time::zoneinfomid::ZoneInfo::zoneId
uint32_t const zoneId
Unique, stable ID of the zone name, created from a hash of the name.
Definition: ZoneInfoMid.h:317
ace_time::zoneinfomid::ZoneInfo::name
const char *const name
Full name of zone (e.g.
Definition: ZoneInfoMid.h:310
ace_time::zoneinfomid::ZoneInfo::eras
const ZoneEra< S > *const eras
A const ZoneEras* pointer to numEras ZoneEra entries in increasing order of UNTIL time.
Definition: ZoneInfoMid.h:343
ace_time::zoneinfomid::ZoneInfo::numEras
uint8_t const numEras
Number of ZoneEra entries.
Definition: ZoneInfoMid.h:337
ace_time::zoneinfomid::ZoneInfo::zoneContext
const ZC *const zoneContext
ZoneContext metadata.
Definition: ZoneInfoMid.h:320
ace_time::zoneinfomid::ZoneInfo::targetInfo
const ZoneInfo *const targetInfo
If Link, points to the target zone info.
Definition: ZoneInfoMid.h:346
ace_time::zoneinfomid::ZonePolicy
A collection of transition rules which describe the DST rules of a given administrative region.
Definition: ZoneInfoMid.h:196
ace_time::zoneinfomid::ZoneRule
A time zone transition rule.
Definition: ZoneInfoMid.h:117
ace_time::zoneinfomid::ZoneRule::toYear
int16_t const toYear
TO year.
Definition: ZoneInfoMid.h:122
ace_time::zoneinfomid::ZoneRule::atTimeModifier
uint8_t const atTimeModifier
The atTimeModifier is a packed field containing 2 pieces of info:
Definition: ZoneInfoMid.h:160
ace_time::zoneinfomid::ZoneRule::onDayOfWeek
uint8_t const onDayOfWeek
Determined by the ON column.
Definition: ZoneInfoMid.h:137
ace_time::zoneinfomid::ZoneRule::inMonth
uint8_t const inMonth
Determined by the IN column.
Definition: ZoneInfoMid.h:125
ace_time::zoneinfomid::ZoneRule::deltaCode
uint8_t const deltaCode
Determined by the SAVE column and contains the offset from UTC, in 15-min increments.
Definition: ZoneInfoMid.h:172
ace_time::zoneinfomid::ZoneRule::letterIndex
uint8_t const letterIndex
Determined by the LETTER column.
Definition: ZoneInfoMid.h:186
ace_time::zoneinfomid::ZoneRule::atTimeCode
uint8_t const atTimeCode
Determined by the AT column in units of 15-minutes from 00:00.
Definition: ZoneInfoMid.h:149
ace_time::zoneinfomid::ZoneRule::onDayOfMonth
int8_t const onDayOfMonth
Determined by the ON column.
Definition: ZoneInfoMid.h:143
ace_time::zoneinfomid::ZoneRule::fromYear
int16_t const fromYear
FROM year.
Definition: ZoneInfoMid.h:119