Skip to content

Commit f839c1c

Browse files
authored
Merge pull request #110 from bxparks/develop
merge 2.2.0 into master
2 parents cad5940 + dd01b31 commit f839c1c

File tree

723 files changed

+72586
-70431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

723 files changed

+72586
-70431
lines changed

CHANGELOG.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,67 @@
11
# Changelog
22

33
* Unreleased
4+
* 2.2.0 (2023-03-24, TZDB version 2023b)
5+
* Upgrade TZDB from 2022g to 2023b
6+
* 2023a skipped because it came out only a day earlier.
7+
* 2023a: https://mm.icann.org/pipermail/tz-announce/2023-March/000077.html
8+
* Egypt now uses DST again, from April through October.
9+
* This year Morocco springs forward April 23, not April 30.
10+
* Palestine delays the start of DST this year.
11+
* Much of Greenland still uses DST from 2024 on.
12+
* America/Yellowknife now links to America/Edmonton.
13+
* tzselect can now use current time to help infer timezone.
14+
* The code now defaults to C99 or later.
15+
* Fix use of C23 attributes.
16+
* 2023b: https://mm.icann.org/pipermail/tz-announce/2023-March/000078.html
17+
* Lebanon delays the start of DST this year.
18+
* **Bug Fix**
19+
* Change arguments for `TimeZone::forMinutes()` from `uint8_t` to
20+
`uint16_t`.
21+
* **Breaking Change**
22+
* Make `TimeZone` effectively immutable, by removing `setStdOffset()`
23+
and `setDstOffset()` methods.
24+
* Client applications should create a new `TimeZone` object using
25+
`TimeZone::forTimeOffset(std, dst)` and overwrite the old one.
26+
* See [Migrating to v2.2](MIGRATING.md#MigratingToVersion220).
27+
* Add support for Seeed Studio XIAO M0 (SAMD21).
28+
* Required updating `zoneino/compat.h` to clobber the broken definition
29+
of `FPSTR()` in Seeeduino 1.8.3.
30+
* Simplify the handling of `Rule.LETTER`.
31+
* Encode all letters as an index into `ZoneContext.letters` array, not
32+
just `LETTER` which are only a single character.
33+
* On 8-bit AVR:
34+
* Increases `BasicZoneProcessor` by ~200 bytes when 1-2 zones are
35+
used. But flash remains the same when the full TZ database is
36+
used.
37+
* No change to `ExtendedZoneProcessor` for 1-2 zones. But decreases
38+
flash usage by ~300 bytes when the full TZ database is used.
39+
* The small increase in flash is worth it because this greatly
40+
simplifies the complicated code surrounding LETTER that was difficult
41+
to understand and maintain.
42+
* Unify Basic and Extended zoneinfo encoding.
43+
* Change encoding of `basic::ZoneRule.deltaCode`,
44+
`basic::ZoneEra.deltaCode`, and `basic::ZoneEra.offsetCode` to be
45+
identical their counterparts in `extended::ZoneXxx`.
46+
* Merge `BasicBrokers.h` and `ExtendedBrokers.h` into just `Brokers.h`.
47+
* Restructure zonedb directories
48+
* Lift `ace_time/internal/testing/tzonedb[x]` database files
49+
to `ace_time/tzonedb[x]`.
50+
* Lift `ace_time/zonedb[x]` database files to `ace_time/zonedb[x]`.
51+
* These changes are transparent to client apps because the C++
52+
namespaces of these files are unchanged.
53+
* Lift `ace_time/internal/Zone*.h` files into new `src/zoneinfo/`
54+
directory. These are the classes that describe the `*zonedb*`
55+
databases.
56+
* Add `ZonedDateTime::offsetDateTime()`
57+
* Returns the underlying `OffsetDateTime` inside the `ZonedDateTime`.
58+
* Analogous to `ZonedDateTime::localDateTime()`.
59+
* Always generate anchor rules in zonedb.
60+
* Allows `ExtendedZoneProcessor` to work over all years `[0,10000)`
61+
even with truncated zonedb (e.g. `[2000,2100)`).
62+
* Accuracy is guaranteed only for the requested interval (e.g.
63+
`[2000,2100)`.
64+
* But the code won't crash outside of that interval.
465
* 2.1.1 (2023-02-02, TZDB version 2022g)
566
* `ZonedExtra`
667
* Add `ZonedExtra::forComponents()` factory method, for consistency with

DEVELOPER.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ ace_time::hw | ace_time::basic
9494
As explained in the README.md, the AceTime library comes with 2 versions of the
9595
[TZ Data](https://www.iana.org/time-zones):
9696

97-
* `src/ace_time/zonedb/*`: files used by the `BasicZoneProcessor` class
98-
* `src/ace_time/zonedbx/*`: files used by the `ExtendedZoneProcessor` class
97+
* `src/zonedb/*`: files used by the `BasicZoneProcessor` class
98+
* `src/zonedbx/*`: files used by the `ExtendedZoneProcessor` class
9999

100100
There are 2 main files in these directories:
101101

@@ -239,11 +239,11 @@ STDOFF (1-min resolution)
239239
---------------> | minute | code |
240240
| (4-bits)| (4-bits) |
241241
+--------------------+
242-
^
243-
RULES (numeric, 15-min resolution) /
244-
-> rules_delta_seconds /
245-
-> rules_delta_code -- (basic) ----------------/
246-
-- (extended) + 4 ---------
242+
^
243+
RULES (numeric, 15-min resolution) /
244+
-> era_delta_seconds /
245+
-> era_delta_minutes /
246+
-> era_delta_code + 4------------------------
247247
248248
249249
UNTIL (1-min resolution)
@@ -280,9 +280,10 @@ AT (1-min resolution)
280280
+--------------------+
281281
282282
SAVE (15-min resolution)
283-
-> delta_seconds +--------------------+
284-
-> delta_code -- (basic) ---------> | deltaCode |
285-
-- (extended) + 4 --> | (8 bits) |
283+
-> delta_seconds
284+
-> delta_minutes +--------------------+
285+
-> delta_code + 4 ----------------> | deltaCode |
286+
| (8 bits) |
286287
+--------------------+
287288
```
288289

@@ -601,14 +602,9 @@ available.
601602
* `$ make validations`
602603
* `$ make runvalidations`
603604
* Update the various zoneinfo files for AceTime:
604-
* `zonedb`
605-
* `$ cd AceTime/src/ace_time/zonedb`
606-
* Update the `TZ_VERSION` variable in `Makefile`.
607-
* `$ make`
608-
* `zonedbx`
609-
* `$ cd AceTime/src/ace_time/zonedbx`
610-
* Update the `TZ_VERSION` variable in `Makefile`.
611-
* `$ make`
605+
* `$ cd AceTime/src`
606+
* Update the `TZ_VERSION` variable in `Makefile`.
607+
* `$ make`
612608
* Update CHANGELOGs
613609
* AceTime/CHANGELOG.md
614610
* AceTimePython/CHANGELOG.md

MIGRATING.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Table of Contents
44

5+
* [Migrating to v2.2.0](#MigratingToVersion220)
56
* [Migrating to v2.1.0](#MigratingToVersion210)
67
* [Unified Links](#UnifiedLinks)
78
* [ZonedExtra](#ZonedExtra)
@@ -18,6 +19,46 @@
1819
* [Migrating the DS3231Clock](#MigratingTheDS3231Clock)
1920
* [Migrating to LinkManagers](#MigratingToLinkManagers)
2021

22+
<a name="MigratingToVersion220"></a>
23+
## Migrating to v2.2
24+
25+
### Immutable TimeZone class
26+
27+
Previously, the `TimeZone` class was semantically immutable when using the
28+
IANA timezones through the `BasicZoneProcessor` or `ExtendedZoneProcessor`.
29+
There was one exception: When the `TimeZone` represented a fixed UTC offset
30+
(e.g. type of `TimeZone::kTypeManual`), the `TimeZone` allowed the STD offset
31+
and DST offset to be modified in-place.
32+
33+
This was a mistake, because the `TimeZone` object was meant to be copied by
34+
value, and allowing it to be mutable meant that 2 different `ZonedDateTime`
35+
objects could intend to hold the same `TimeZone` object, but modifying one
36+
instance would not update the other instance.
37+
38+
In v2.2, the `TimeZone` class becomes immutable, and the following methods are
39+
removed:
40+
41+
```C++
42+
class TimeZone {
43+
public:
44+
void setStdOffset(TimeZone offset);
45+
void setDstOffset(TimeZone offset);
46+
};
47+
```
48+
49+
To modify a `TimeZone`, create a new instance, then call
50+
`ZonedDateTime::convertToTimeZone(const TimeZone& tz)` instead. For example, to
51+
change to Daylight Saving Time for Pacific time:
52+
53+
```C++
54+
TimeZone tz = TimeZone::forHours(-8, 0); // PST time
55+
ZonedDateTime zdt = ZonedDateTime::forComponents(...);
56+
57+
TimeZone newTz = TimeZone::forTimeOffset(
58+
tz.getStdOffset(), TimeOffset::forHours(1));
59+
ZonedDateTime newDt = zdt.convertToTimeZone(newTz);
60+
```
61+
2162
<a name="MigratingToVersion210"></a>
2263
## Migrating to v2.1
2364

0 commit comments

Comments
 (0)