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

ZoneInfoHigh.h
Go to the documentation of this file.
1 /*
2 * MIT License
3 * Copyright (c) 2023 Brian T. Park
4 */
5
6 #ifndef ACE_TIME_ZONE_INFO_HIGH_H
7 #define ACE_TIME_ZONE_INFO_HIGH_H
8
27 #include <stdint.h>
28
29 namespace ace_time {
30 namespace zoneinfohigh {
31
36 template<typename S>
37 struct ZoneContext {
44 static const int16_t kMaxUntilYear = 32767;
45
52 static const int16_t kMaxYear = kMaxUntilYear - 1;
53
62 static const int16_t kMinYear = -32767;
63
65 static const uint8_t kSuffixW = 0x00;
66
68 static const uint8_t kSuffixS = 0x10;
69
71 static const uint8_t kSuffixU = 0x20;
72
74 int16_t const startYear;
75
77 int16_t const untilYear;
78
80 int16_t const startYearAccurate;
81
83 int16_t const untilYearAccurate;
84
86 int16_t const baseYear;
87
89 int16_t const maxTransitions;
90
92 const char* const tzVersion;
93
95 uint8_t const numFragments;
96
98 uint8_t const numLetters;;
99
101 const char* const* const fragments;
102
104 const char* const* const letters;
105 };
106
112 template<typename S>
113 struct ZoneRule {
115 int16_t const fromYear;
116
118 int16_t const toYear;
119
121 uint8_t const inMonth;
122
133 uint8_t const onDayOfWeek;
134
139 int8_t const onDayOfMonth;
140
150 uint8_t const atTimeModifier;
151
156 uint16_t const atTimeCode;
157
163 int8_t const deltaMinutes;
164
177 uint8_t const letterIndex;
178 };
179
186 template<typename S>
187 struct ZonePolicy {
188 const ZoneRule<S>* const rules;
189 uint8_t const numRules;
190 };
191
205 template<typename S>
206 struct ZoneEra {
211 const ZonePolicy<S>* const zonePolicy;
212
237 const char* const format;
238
243 int16_t const offsetCode;
244
246 uint8_t const offsetRemainder;
247
254 int8_t const deltaMinutes;
255
259 int16_t const untilYear;
260
262 uint8_t const untilMonth;
263
269 uint8_t const untilDay;
270
275 uint16_t const untilTimeCode;
276
287 uint8_t const untilTimeModifier;
288 };
289
294 template<typename S, typename ZC>
295 struct ZoneInfo {
297 const char* const name;
298
304 uint32_t const zoneId;
305
307 const ZC* const zoneContext;
308
324 uint8_t const numEras;
325
330 const ZoneEra<S>* const eras;
331
333 const ZoneInfo* const targetInfo;
334 };
335
336 } // zoneinfohigh
337 } // ace_time
338
339 #endif
ace_time::zoneinfohigh::ZoneContext
Metadata about the zone database.
Definition: ZoneInfoHigh.h:37
ace_time::zoneinfohigh::ZoneContext::kSuffixW
static const uint8_t kSuffixW
Represents 'w' or wall time.
Definition: ZoneInfoHigh.h:65
ace_time::zoneinfohigh::ZoneContext::maxTransitions
int16_t const maxTransitions
Max number of transitions required in TransitionStorage.
Definition: ZoneInfoHigh.h:89
ace_time::zoneinfohigh::ZoneContext::numLetters
uint8_t const numLetters
Number of fragments.
Definition: ZoneInfoHigh.h:98
ace_time::zoneinfohigh::ZoneContext::untilYear
int16_t const untilYear
Until year of the zone files as requested.
Definition: ZoneInfoHigh.h:77
ace_time::zoneinfohigh::ZoneContext::startYear
int16_t const startYear
Start year of the zone files as requested.
Definition: ZoneInfoHigh.h:74
ace_time::zoneinfohigh::ZoneContext::baseYear
int16_t const baseYear
Base year for tiny years.
Definition: ZoneInfoHigh.h:86
ace_time::zoneinfohigh::ZoneContext::kMaxYear
static const int16_t kMaxYear
The maximum value fromYear and toYear.
Definition: ZoneInfoHigh.h:52
ace_time::zoneinfohigh::ZoneContext::numFragments
uint8_t const numFragments
Number of fragments.
Definition: ZoneInfoHigh.h:95
ace_time::zoneinfohigh::ZoneContext::fragments
const char *const *const fragments
Zone Name fragment list.
Definition: ZoneInfoHigh.h:98
ace_time::zoneinfohigh::ZoneContext::untilYearAccurate
int16_t const untilYearAccurate
Until year of accurate transitions.
Definition: ZoneInfoHigh.h:83
ace_time::zoneinfohigh::ZoneContext::letters
const char *const *const letters
Zone Rule letters list.
Definition: ZoneInfoHigh.h:104
ace_time::zoneinfohigh::ZoneContext::kMaxUntilYear
static const int16_t kMaxUntilYear
The maximum value of untilYear.
Definition: ZoneInfoHigh.h:44
ace_time::zoneinfohigh::ZoneContext::kSuffixS
static const uint8_t kSuffixS
Represents 's' or standard time.
Definition: ZoneInfoHigh.h:68
ace_time::zoneinfohigh::ZoneContext::kMinYear
static const int16_t kMinYear
The minimum value of fromYear and toYear.
Definition: ZoneInfoHigh.h:62
ace_time::zoneinfohigh::ZoneContext::kSuffixU
static const uint8_t kSuffixU
Represents 'u' or UTC time.
Definition: ZoneInfoHigh.h:71
ace_time::zoneinfohigh::ZoneContext::startYearAccurate
int16_t const startYearAccurate
Start year of accurate transitions.
Definition: ZoneInfoHigh.h:80
ace_time::zoneinfohigh::ZoneContext::tzVersion
const char *const tzVersion
TZ Database version which generated the zone info.
Definition: ZoneInfoHigh.h:92
ace_time::zoneinfohigh::ZoneEra
An entry in ZoneInfo which describes which ZonePolicy was being followed during a particular time per...
Definition: ZoneInfoHigh.h:206
ace_time::zoneinfohigh::ZoneEra::format
const char *const format
Zone abbreviations (e.g.
Definition: ZoneInfoHigh.h:237
ace_time::zoneinfohigh::ZoneEra::deltaMinutes
int8_t const deltaMinutes
If zonePolicy is nullptr, this is the DST offset in minutes as defined by the RULES column in 'hh:mm'...
Definition: ZoneInfoHigh.h:254
ace_time::zoneinfohigh::ZoneEra::zonePolicy
const ZonePolicy< S > *const zonePolicy
Zone policy, determined by the RULES column.
Definition: ZoneInfoHigh.h:211
ace_time::zoneinfohigh::ZoneEra::untilTimeCode
uint16_t const untilTimeCode
The time field of UNTIL field in 15-second increments.
Definition: ZoneInfoHigh.h:275
ace_time::zoneinfohigh::ZoneEra::untilMonth
uint8_t const untilMonth
The month field in UNTIL (1-12).
Definition: ZoneInfoHigh.h:262
ace_time::zoneinfohigh::ZoneEra::offsetRemainder
uint8_t const offsetRemainder
The remainder seconds from offsetCode.
Definition: ZoneInfoHigh.h:246
ace_time::zoneinfohigh::ZoneEra::offsetCode
int16_t const offsetCode
UTC offset in 15-second increments.
Definition: ZoneInfoHigh.h:243
ace_time::zoneinfohigh::ZoneEra::untilTimeModifier
uint8_t const untilTimeModifier
The untilTimeModifier is a packed field containing 2 pieces of info:
Definition: ZoneInfoHigh.h:287
ace_time::zoneinfohigh::ZoneEra::untilDay
uint8_t const untilDay
The day field in UNTIL (1-31).
Definition: ZoneInfoHigh.h:269
ace_time::zoneinfohigh::ZoneEra::untilYear
int16_t const untilYear
Era is valid until currentTime < untilYear.
Definition: ZoneInfoHigh.h:259
ace_time::zoneinfohigh::ZoneInfo
Representation of a given time zone, implemented as an array of ZoneEra records.
Definition: ZoneInfoHigh.h:295
ace_time::zoneinfohigh::ZoneInfo::zoneId
uint32_t const zoneId
Unique, stable ID of the zone name, created from a hash of the name.
Definition: ZoneInfoHigh.h:304
ace_time::zoneinfohigh::ZoneInfo::targetInfo
const ZoneInfo *const targetInfo
If Link, points to the target zone info.
Definition: ZoneInfoHigh.h:333
ace_time::zoneinfohigh::ZoneInfo::eras
const ZoneEra< S > *const eras
A const ZoneEras* pointer to numEras ZoneEra entries in increasing order of UNTIL time.
Definition: ZoneInfoHigh.h:330
ace_time::zoneinfohigh::ZoneInfo::numEras
uint8_t const numEras
Number of ZoneEra entries.
Definition: ZoneInfoHigh.h:324
ace_time::zoneinfohigh::ZoneInfo::name
const char *const name
Full name of zone (e.g.
Definition: ZoneInfoHigh.h:297
ace_time::zoneinfohigh::ZoneInfo::zoneContext
const ZC *const zoneContext
ZoneContext metadata.
Definition: ZoneInfoHigh.h:307
ace_time::zoneinfohigh::ZonePolicy
A collection of transition rules which describe the DST rules of a given administrative region.
Definition: ZoneInfoHigh.h:187
ace_time::zoneinfohigh::ZoneRule
A time zone transition rule.
Definition: ZoneInfoHigh.h:113
ace_time::zoneinfohigh::ZoneRule::fromYear
int16_t const fromYear
FROM year.
Definition: ZoneInfoHigh.h:115
ace_time::zoneinfohigh::ZoneRule::toYear
int16_t const toYear
TO year.
Definition: ZoneInfoHigh.h:118
ace_time::zoneinfohigh::ZoneRule::letterIndex
uint8_t const letterIndex
Determined by the LETTER column.
Definition: ZoneInfoHigh.h:177
ace_time::zoneinfohigh::ZoneRule::onDayOfMonth
int8_t const onDayOfMonth
Determined by the ON column.
Definition: ZoneInfoHigh.h:139
ace_time::zoneinfohigh::ZoneRule::atTimeModifier
uint8_t const atTimeModifier
The atTimeModifier is a packed field containing 2 pieces of info:
Definition: ZoneInfoHigh.h:150
ace_time::zoneinfohigh::ZoneRule::onDayOfWeek
uint8_t const onDayOfWeek
Determined by the ON column.
Definition: ZoneInfoHigh.h:133
ace_time::zoneinfohigh::ZoneRule::atTimeCode
uint16_t const atTimeCode
Determined by the AT column in units of 15-seconds from 00:00.
Definition: ZoneInfoHigh.h:156
ace_time::zoneinfohigh::ZoneRule::deltaMinutes
int8_t const deltaMinutes
Determined by the SAVE column and contains the offset from UTC in minutes.
Definition: ZoneInfoHigh.h:163
ace_time::zoneinfohigh::ZoneRule::inMonth
uint8_t const inMonth
Determined by the IN column.
Definition: ZoneInfoHigh.h:121