Skip to content

Commit 02a56f3

Browse files
authored
Merge pull request #33 from bxparks/develop
merge 1.1.1 into master
2 parents 36b5c61 + e431ff2 commit 02a56f3

File tree

829 files changed

+58843
-14805
lines changed

Some content is hidden

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

829 files changed

+58843
-14805
lines changed

.github/workflows/ccpp.yml renamed to .github/workflows/aunit_tests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: C/C++ CI
1+
name: AUnit Tests
22

33
on: [push]
44

@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-18.04
99

1010
steps:
11-
- uses: actions/checkout@v1
11+
- uses: actions/checkout@v2
1212

1313
- name: Setup
1414
run: |
@@ -17,9 +17,12 @@ jobs:
1717
git clone https://github.com/bxparks/AceButton
1818
git clone https://github.com/bxparks/AceRoutine
1919
git clone https://github.com/bxparks/AUnit
20+
git clone https://github.com/bxparks/AceUtils
21+
2022
- name: Verify examples
2123
run: |
2224
make -C examples
25+
2326
- name: Verify tests
2427
run: |
2528
make -C tests

.github/workflows/pythonpackage.yml renamed to .github/workflows/python_tools.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Python package
4+
name: Python Tools
55

66
on:
77
push:
@@ -12,30 +12,34 @@ on:
1212
jobs:
1313
build:
1414

15-
runs-on: ubuntu-latest
15+
runs-on: ubuntu-18.04
1616
strategy:
1717
matrix:
1818
python-version: [3.7, 3.8]
1919

2020
steps:
2121
- uses: actions/checkout@v2
22+
2223
- name: Set up Python ${{ matrix.python-version }}
2324
uses: actions/setup-python@v1
2425
with:
2526
python-version: ${{ matrix.python-version }}
27+
2628
- name: Install dependencies
2729
run: |
2830
python -m pip install --upgrade pip
29-
# pip install -r requirements.txt
30-
pip install flake8 mypy pytz python-dateutil
31+
pip install -r tools/requirements.txt
32+
3133
- name: Lint with flake8
3234
run: |
3335
cd tools
3436
make flake8
37+
3538
- name: Type checking with MyPy
3639
run: |
3740
cd tools
3841
make mypy
42+
3943
- name: Test with unittest
4044
run: |
4145
cd tools

.github/workflows/validation.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# See the following for information on how to setup the Python workflow for a
2+
# single version:
3+
# https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions
4+
5+
name: Validation Tests
6+
7+
on: [push]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-18.04
13+
14+
# Tried to use
15+
# https://github.com/actions/checkout#Checkout-multiple-repos-side-by-side,
16+
# but it looks like GITHUB_WORKSPACE is set to
17+
# /home/runner/work/AceTime/AceTime, so if path is set to 'main' as
18+
# suggested in the article, then the repos is set to
19+
# /home/runner/work/Acetime/AceTime/main/AceTime, which is really
20+
# confusing. Instead, use 'cd ..' to go up a level and call 'git clone'
21+
# manually.
22+
steps:
23+
- name: Checkout AceTime
24+
uses: actions/checkout@v2
25+
26+
- name: Checkout 3rd Party Repos
27+
run: |
28+
cd ..
29+
git clone https://github.com/bxparks/UnixHostDuino
30+
git clone https://github.com/bxparks/AUnit
31+
git clone https://github.com/eggert/tz
32+
git clone https://github.com/HowardHinnant/date
33+
34+
- name: Install libcurl4-openssl-dev
35+
run: |
36+
sudo apt update
37+
sudo apt install -y libcurl4-openssl-dev
38+
39+
- name: Set up Python 3.7
40+
uses: actions/setup-python@v1
41+
with:
42+
python-version: '3.7'
43+
44+
- name: Display Python version
45+
run: python -c "import sys; print(sys.version)"
46+
47+
- name: Install Python Dependencies
48+
run: |
49+
python -m pip install --upgrade pip
50+
pip install -r tools/requirements.txt
51+
52+
- name: Build compare_cpp
53+
run: |
54+
cd tools/compare_cpp
55+
make
56+
57+
# Run just BasicHinnantDateTest and ExtendedHinnantDateTest. When a new
58+
# TZDB version comes out, the Python pytz, dateutil, and Java validation
59+
# tests will always fail because they depend on the obsolete TZ database on
60+
# the hosted Operating System.
61+
62+
- name: BasicHinnantDateTest
63+
run: |
64+
make -C tests/validation/BasicHinnantDateTest
65+
make -C tests/validation/BasicHinnantDateTest runtests
66+
67+
- name: ExtendedHinnantDateTest
68+
run: |
69+
make -C tests/validation/ExtendedHinnantDateTest
70+
make -C tests/validation/ExtendedHinnantDateTest runtests

CHANGELOG.md

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

33
* Unreleased
4+
* 1.1.1 (2020-10-18, TZ DB version 2020c)
5+
* Add documentation for using the `PrintStr<N>` class from the AceUtils
6+
library (https://github.com:bxparks/AceUtils) on the various `printTo()`
7+
methods. The string content can be retrieved using the
8+
`PrintStr::getCstr()` method which returns a normal `const char*`
9+
C-string. The `PrintStr<N>` class replaces an earlier, unreleased version
10+
that was called `CstrPrint<N>`.
11+
* Add 'Validation Tests' GitHub workflow for running
12+
`tests/validation/*Test`.
13+
* Create `blacklist.json` file for each `compare_xxx` tools, to disable
14+
validation checks for DST or abbreviations due to bugs in the 3rd party
15+
libraries.
16+
* Add `ValidationScope` enum to provide better control over whether the
17+
DST or abbrev fields are validated.
18+
* Print better diagnostic messages when `tests/validation` fails in
19+
`BasicTransitionTest` and `ExtendedTransitionTest` classes.
20+
* Upgrade target version numbers of 3rd party libraries used for
21+
tests/validation: pytz from 2019.3 to 2020.1, JDK 11.0.6 to 11.0.8.
22+
* Upgrade to TZDB 2020c.
23+
* Restrict GitHub Actions workflow to run just BasicHinnantDateTest and
24+
ExtendedHinnantDateTest, because the other Python and Java tests break
25+
every time a new TZDB version comes out.
26+
* Add `DEVELOPER.md` file containing notes mostly for myself.
427
* 1.1 (2020-04-25, TZ DB version 2020a)
528
* Fix broken links in `README.md`.
629
* Fix typos in `USER_GUIDE.md` and update its version number to 1.0 as it

DEVELOPER.md

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# Developer Notes
2+
3+
Information which are useful for developers and maintainers of the AceTime
4+
library.
5+
6+
## Zone DB Files
7+
8+
As explained in the README.md, the AceTime library comes with 2 versions of the
9+
[TZ Data](https://www.iana.org/time-zones):
10+
11+
* `src/ace_time/zonedb/*`: files used by the `BasicZoneProcessor` class
12+
* `src/ace_time/zonedbx/*`: files used by the `ExtendedZoneProcessor` class
13+
14+
There are 2 main files in these directories:
15+
16+
* `zone_infos.h', `zone_infos.cpp`
17+
* `zone_policies.h`, `zone_policies.cpp`
18+
19+
The format and meaning of these files are probably best explained in the header
20+
files:
21+
22+
* `src/ace_time/internal/ZoneInfo.h`
23+
* `src/ace_time/internal/ZonePolicy.h`
24+
25+
Some of the tricky encoding schemes were created to preserve resolution, while
26+
keeping the binary size of the data structures as small as possible. For
27+
example, these files are able to support DST transitions with a 1-minute
28+
resolution, but the DST offsets have only a 15-minute resolution. Fortunately,
29+
these limitations are sufficient to represent all time zones since about 1972.
30+
31+
Other bits of information are added by the code generator as comments in the
32+
generated files and some of these are explained below.
33+
34+
### `zone_infos.h`
35+
36+
This file contains one entry of the `basic::ZoneInfo` or
37+
`extended::ZoneInfo` data structure for each supported time zone.
38+
39+
The zone identifier is named `kZone{region}_{city}`, where the
40+
`{region}_{city}` comes directly from the TZ Database. Some minor character
41+
transformations are applied to create an valid C++ identifier. For example, all
42+
dashes `-` are converted to underscore `_`.
43+
44+
The `kTzDatabaseVersion` string constant identifies the version of the TZ
45+
Database that was used to generate these files, e.g. "2019a".
46+
47+
The `kZoneContext` variable points to an instance of `common::ZoneContext`
48+
which identifies the `startYear` and `endYear` of the current database. These
49+
will normally be 2000 and 2050 respectively, but a custom version of the
50+
zonedb files could be generated whose startYear and endYear could be smaller (to
51+
produce smaller ZoneDB files).
52+
53+
Near end of the `zone_info.h` file, we list the zones which were
54+
deliberately excluded by the tool.
55+
56+
Also at the end of the `zone_info.h` file, there may be warnings about
57+
known inaccuracies for a particular zone.
58+
59+
### `zone_infos.cpp`
60+
61+
Each zone entry in the `zone_info.cpp` contains a comment section that
62+
describes some metadata about the given entry. For example, the entry for
63+
`zonedb::kZoneEraAmerica_Los_Angeles` contains the following, showing how
64+
much memory it will consume on the 8-bit Arduino controllers and the 32-bit
65+
Arduino controllers:
66+
67+
* `// Zone name: America/Los_Angeles`
68+
* `// Era count: 1`
69+
* `// Strings: 24`
70+
* `// Memory (8-bit): 43`
71+
* `// Memory (32-bit): 53`
72+
73+
### `zone_policies.h`
74+
75+
An entry in `zone_info.cpp` may refer to a zone policy defined in
76+
`zone_policies.h`. For example, the `kZoneAmerica_Los_Angeles` has a pointer
77+
to a `kPolicyUS` data structure which is defined in `zone_policies.h`.
78+
79+
Each policy entry starts with a comment secion that contains some metadata
80+
about the policy. For example:
81+
```
82+
// Policy name: US
83+
// Rule count: 5
84+
// Memory (8-bit): 51
85+
// Memory (32-bit): 55
86+
```
87+
Just like `zone_infos.cpp`, the Memory section describes the amount of static
88+
RAM consumed by the particular `ZonePolicy` data structure (and associated
89+
`ZoneRule`.
90+
91+
## Upgrading ZoneInfo Files to a New TZDB Version
92+
93+
About 2-4 times a year, a new TZDB version is released. Here are some notes
94+
(mostly for myself) on how to create a new release after a new TZDB version is
95+
available.
96+
97+
* Update the TZDB repo (https://github.com/eggert/tz). This should be a
98+
sibling to the `AceTime` repo (since it will cause the least problems
99+
for various internal scripts):
100+
* `$ cd ../tz`
101+
* `$ git pull`
102+
* Check that the correct tag is pulled (e.g. `2020c` tag if that's the
103+
version that we want to upgrade to).
104+
* Update the Hinnant date repo (https://github.com:HowardHinnant/date). This
105+
should be a sibling to the `AceTime` repo:
106+
* `$ cd ../date`
107+
* `$ git pull`
108+
* Verify that `AceTime` and Hinnant `date` agree with each other using the
109+
same TZDB version.
110+
* BasicHinnantDateTest
111+
* `$ cd tests/validation/BasicHinnantDateTest`
112+
* Update the `TZ_VERSION` variable in the `Makefile` with the commit tag
113+
of the new TZDB version. (e.g. `TZ_VERSION = 2020c`).
114+
* `$ make clean`
115+
* `$ make`
116+
* `$ ./BasicHinnantDateTest.out | grep failed`
117+
* There should be no failures: `TestRunner summary: 268 passed, 0
118+
failed, 0 skipped, 0 timed out, out of 268 test(s).`
119+
* ExtendedHinnantDateTest
120+
* `$ cd tests/validation/ExtendedHinnantDateTest`
121+
* Update the `TZ_VERSION` variable in the `Makefile` with the commit tag
122+
of the new TZDB version. (e.g. `TZ_VERSION = 2020c`).
123+
* `$ make clean`
124+
* `$ make`
125+
* `$ ./ExtendedHinnantDateTest.out | grep failed`
126+
* There should be no failures: `TestRunner summary: 387 passed, 0
127+
failed, 0 skipped, 0 timed out, out of 387 test(s).`
128+
* Update the `src/ace_time/zonedb` and `zonedbx` zone info files:
129+
* zonedb
130+
* `$ cd src/ace_time/zonedb`
131+
* Update the `TZ_VERSION` in the `Makefile`.
132+
* `$ make clean`
133+
* `$ make`
134+
* zonedbx
135+
* `$ cd src/ace_time/zonedbx`
136+
* Update the `TZ_VERSION` in the `Makefile`.
137+
* `$ make clean`
138+
* `$ make`
139+
* Update the CHANGELOG.md.
140+
* Commit the changes to git
141+
* `$ git add ...`
142+
* `$ git commit -m "..."`
143+
144+
There are 6 other validation tests in `tests/validation` that compare AceTime
145+
with other 3rd party librarties (Python pytz, Python dateutil, and Java date).
146+
Unfortunately, they all seem to use the underlying TZDB version provided by the
147+
Operating System, and I have not been able to figure out how to manually update
148+
this dependency manually. When a new TZDB is released, all of these other tests
149+
will fail until the underying timezone database of the OS is updated.
150+
151+
## Release Process
152+
153+
* Update and commit the version numbers in various files:
154+
* `src/AceTime.h`
155+
* `README.md`
156+
* `USER_GUIDE.md`
157+
* `docs/doxygen.cfg`
158+
* `library.properties`
159+
* `CHANGELOG.md`
160+
* `$ git commit -m "..."`
161+
* Update and commit the Doxygen docs. This is done as a separate git commit
162+
because the Doxygen changes are often so large that they obscure all other
163+
important changes to the code base:
164+
* `$ cd docs`
165+
* `$ make clean`
166+
* `$ make`
167+
* `$ git add .`
168+
* `$ git commit -m "..."`
169+
* Merge the `develop` branch into `master`.
170+
* Normally I do this with a PR on GitHub to keep an audit trail.
171+
* Go to https://github.com/bxparks/AceTime.
172+
* Create a Pull Request from `develop` to `master`
173+
* Approve and merge the PR.
174+
* Create a new Release.
175+
* Go to https://github.com/bxparks/AceTime
176+
* Click on "Releases"
177+
* Click on "Draft a new release"
178+
* Enter a tag version (e.g. 'v1.2`), targeting the `master` branch.
179+
* Enter the release title.
180+
* Enter the release notes. I normally just copy and paste the latest changes
181+
from `CHANGELOG.md`.
182+
* Click Publish release.

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ Conversion from an epochSeconds to date-time components including timezone
211211
* 2.8 microseconds on an ESP32,
212212
* 6 microseconds on a Teensy 3.2.
213213

214-
**Version**: 1.1 (2020-04-25, TZ DB version 2020a)
214+
**Version**: 1.1.1 (2020-10-18, TZ DB version 2020c)
215+
216+
**Changelog**: [CHANGELOG.md](CHANGELOG.md)
215217

216218
## Examples
217219

@@ -508,10 +510,6 @@ I will occasionally test on the following hardware as a sanity check:
508510
* Teensy 3.2 (72 MHz ARM Cortex-M4)
509511
* Mini Mega 2560 (Arduino Mega 2560 compatible, 16 MHz ATmega2560)
510512

511-
## Changelog
512-
513-
See [CHANGELOG.md](CHANGELOG.md).
514-
515513
## License
516514

517515
[MIT License](https://opensource.org/licenses/MIT)

0 commit comments

Comments
 (0)