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
Metadata about the zone database.
Definition: ZoneInfoHigh.h:37
static const uint8_t kSuffixW
Represents 'w' or wall time.
Definition: ZoneInfoHigh.h:65
int16_t const maxTransitions
Max number of transitions required in TransitionStorage.
Definition: ZoneInfoHigh.h:89
uint8_t const numLetters
Number of fragments.
Definition: ZoneInfoHigh.h:98
int16_t const untilYear
Until year of the zone files as requested.
Definition: ZoneInfoHigh.h:77
int16_t const startYear
Start year of the zone files as requested.
Definition: ZoneInfoHigh.h:74
int16_t const baseYear
Base year for tiny years.
Definition: ZoneInfoHigh.h:86
static const int16_t kMaxYear
The maximum value fromYear and toYear.
Definition: ZoneInfoHigh.h:52
uint8_t const numFragments
Number of fragments.
Definition: ZoneInfoHigh.h:95
const char *const *const fragments
Zone Name fragment list.
Definition: ZoneInfoHigh.h:98
int16_t const untilYearAccurate
Until year of accurate transitions.
Definition: ZoneInfoHigh.h:83
const char *const *const letters
Zone Rule letters list.
Definition: ZoneInfoHigh.h:104
static const int16_t kMaxUntilYear
The maximum value of untilYear.
Definition: ZoneInfoHigh.h:44
static const uint8_t kSuffixS
Represents 's' or standard time.
Definition: ZoneInfoHigh.h:68
static const int16_t kMinYear
The minimum value of fromYear and toYear.
Definition: ZoneInfoHigh.h:62
static const uint8_t kSuffixU
Represents 'u' or UTC time.
Definition: ZoneInfoHigh.h:71
int16_t const startYearAccurate
Start year of accurate transitions.
Definition: ZoneInfoHigh.h:80
const char *const tzVersion
TZ Database version which generated the zone info.
Definition: ZoneInfoHigh.h:92
An entry in ZoneInfo which describes which ZonePolicy was being followed during a particular time per...
Definition: ZoneInfoHigh.h:206
const char *const format
Zone abbreviations (e.g.
Definition: ZoneInfoHigh.h:237
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
const ZonePolicy< S > *const zonePolicy
Zone policy, determined by the RULES column.
Definition: ZoneInfoHigh.h:211
uint16_t const untilTimeCode
The time field of UNTIL field in 15-second increments.
Definition: ZoneInfoHigh.h:275
uint8_t const untilMonth
The month field in UNTIL (1-12).
Definition: ZoneInfoHigh.h:262
uint8_t const offsetRemainder
The remainder seconds from offsetCode.
Definition: ZoneInfoHigh.h:246
int16_t const offsetCode
UTC offset in 15-second increments.
Definition: ZoneInfoHigh.h:243
uint8_t const untilTimeModifier
The untilTimeModifier is a packed field containing 2 pieces of info:
Definition: ZoneInfoHigh.h:287
uint8_t const untilDay
The day field in UNTIL (1-31).
Definition: ZoneInfoHigh.h:269
int16_t const untilYear
Era is valid until currentTime < untilYear.
Definition: ZoneInfoHigh.h:259
Representation of a given time zone, implemented as an array of ZoneEra records.
Definition: ZoneInfoHigh.h:295
uint32_t const zoneId
Unique, stable ID of the zone name, created from a hash of the name.
Definition: ZoneInfoHigh.h:304
const ZoneInfo *const targetInfo
If Link, points to the target zone info.
Definition: ZoneInfoHigh.h:333
const ZoneEra< S > *const eras
A const ZoneEras* pointer to numEras ZoneEra entries in increasing order of UNTIL time.
Definition: ZoneInfoHigh.h:330
uint8_t const numEras
Number of ZoneEra entries.
Definition: ZoneInfoHigh.h:324
const char *const name
Full name of zone (e.g.
Definition: ZoneInfoHigh.h:297
const ZC *const zoneContext
ZoneContext metadata.
Definition: ZoneInfoHigh.h:307
A collection of transition rules which describe the DST rules of a given administrative region.
Definition: ZoneInfoHigh.h:187
A time zone transition rule.
Definition: ZoneInfoHigh.h:113
int16_t const fromYear
FROM year.
Definition: ZoneInfoHigh.h:115
int16_t const toYear
TO year.
Definition: ZoneInfoHigh.h:118
uint8_t const letterIndex
Determined by the LETTER column.
Definition: ZoneInfoHigh.h:177
int8_t const onDayOfMonth
Determined by the ON column.
Definition: ZoneInfoHigh.h:139
uint8_t const atTimeModifier
The atTimeModifier is a packed field containing 2 pieces of info:
Definition: ZoneInfoHigh.h:150
uint8_t const onDayOfWeek
Determined by the ON column.
Definition: ZoneInfoHigh.h:133
uint16_t const atTimeCode
Determined by the AT column in units of 15-seconds from 00:00.
Definition: ZoneInfoHigh.h:156
int8_t const deltaMinutes
Determined by the SAVE column and contains the offset from UTC in minutes.
Definition: ZoneInfoHigh.h:163
uint8_t const inMonth
Determined by the IN column.
Definition: ZoneInfoHigh.h:121