Skip to content

Commit 36b5c61

Browse files
authored
Merge pull request #30 from bxparks/develop
merge v1.1 into master
2 parents e40a6ad + da7191d commit 36b5c61

File tree

407 files changed

+7813
-221503
lines changed

Some content is hidden

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

407 files changed

+7813
-221503
lines changed

.github/workflows/ccpp.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ jobs:
1919
git clone https://github.com/bxparks/AUnit
2020
- name: Verify examples
2121
run: |
22-
make -C examples clean
2322
make -C examples
2423
- name: Verify tests
2524
run: |
26-
make -C tests clean
2725
make -C tests
2826
make -C tests runtests
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
branches: [ develop ]
9+
pull_request:
10+
branches: [ develop ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
python-version: [3.7, 3.8]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v1
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
# pip install -r requirements.txt
30+
pip install flake8 mypy pytz python-dateutil
31+
- name: Lint with flake8
32+
run: |
33+
cd tools
34+
make flake8
35+
- name: Type checking with MyPy
36+
run: |
37+
cd tools
38+
make mypy
39+
- name: Test with unittest
40+
run: |
41+
cd tools
42+
make tests

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,13 @@ wheels/
6565
*.egg
6666
MANIFEST
6767
*.app
68+
69+
#-------------------------------------------------------------------------
70+
# Generated files and directories under tests/validation/*Test/
71+
#-------------------------------------------------------------------------
72+
73+
tests/validation/*Test/validation_*.h
74+
tests/validation/*Test/validation_*.cpp
75+
tests/validation/*Test/validation_*.json
76+
tests/validation/*Test/zonedb*
77+
tests/validation/*Test/tzfiles

CHANGELOG.md

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

33
* Unreleased
4+
* 1.1 (2020-04-25, TZ DB version 2020a)
5+
* Fix broken links in `README.md`.
6+
* Fix typos in `USER_GUIDE.md` and update its version number to 1.0 as it
7+
should have been back in October.
8+
* Massive refactor of `./tools` processing pipeline and update
9+
`validation/tests`.
10+
* Add mypy strict type checking for Python scripts under `tools`.
11+
* Funnel `validation*.{h,cpp}` code generation through a single program
12+
using a `validation_data.json` intermediate file.
13+
* Funnel processing of TZDB output from `transformer.py` into a single
14+
`tzdbcollector.py` which can produce a `tzdb.json` output.
15+
* Separate `validator.py` processing into a distinct section.
16+
* Add validation tests against Python `dateutil` library (similar to
17+
`pytz`).
18+
* Update TZ Database version to 2020a that was released on 2020-04-23.
419
* 1.0 (2019-10-02, TZ DB version 2019c)
520
* Add initial support for GitHub actions to implement continuous integration
621
using the unit tests that run under UnitHostDuino.

README.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,13 @@ The zoneinfo files (and their associated `ZoneProcessor` classes) have a
121121
resolution of 1 minute, which is sufficient to represent all UTC offsets and DST
122122
shifts of all timezones after 1972 (Africa/Monrovia was the last timezone to
123123
switch to UTC time on Jan 7, 1972). These zoneinfo files and the algorithms in
124-
this library have been validated to match the UTC offsets calculated using 3
124+
this library have been validated to match the UTC offsets calculated using 4
125125
other date/time libraries:
126126

127127
* the Python [pytz](https://pypi.org/project/pytz/) library from
128128
the year 2000 until 2037 (inclusive),
129+
* the Python [dateutil](https://pypi.org/project/python-dateutil/) library from
130+
the year 2000 until 2037 (inclusive),
129131
* the Java JDK 11
130132
[java.time](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/package-summary.html)
131133
library from year 2000 to 2049 (inclusive),
@@ -209,9 +211,7 @@ Conversion from an epochSeconds to date-time components including timezone
209211
* 2.8 microseconds on an ESP32,
210212
* 6 microseconds on a Teensy 3.2.
211213

212-
**Version**: 1.0 (2019-10-02, TZ DB version 2019c)
213-
214-
**Status**: Graduated to v1.0.
214+
**Version**: 1.1 (2020-04-25, TZ DB version 2020a)
215215

216216
## Examples
217217

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

511-
### Untested RTC hardware compatibility
512-
513-
As DS1307 and DS3232 RTC chip have exactly same interface as DS3231 for used
514-
features except temperature on DS1307 (this one lacks this functionality),
515-
this class could be be used to control all of them.
516-
517-
Any problem with these RTCs please, contact @Naguissa (https://github.com/Naguissa/AceTime)
518-
519-
520511
## Changelog
521512

522513
See [CHANGELOG.md](CHANGELOG.md).

USER_GUIDE.md

Lines changed: 67 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
See the [README.md](README.md) for introductory background.
44

5-
Version: 0.8.1 (2019-08-26, TZ DB version 2019b, beta)
5+
Version: 1.1 (2020-04-25, TZ DB version 2020a)
66

77
## Installation
88

@@ -68,9 +68,10 @@ usually have more precise dependency information:
6868
Various scripts in the `tools/` directory depend on:
6969

7070
* [IANA TZ Database on GitHub](https://github.com/eggert/tz)
71-
* [pytz library](https://pypi.org/project/pytz/)
71+
* [Python pytz library](https://pypi.org/project/pytz/)
72+
* [Python dateutil library](https://pypi.org/project/python-dateutil)
7273
* [Hinnant date library](https://github.com/HowardHinnant/date)
73-
* Python 3.5 or greater
74+
* Python 3.6 or greater
7475
* Java OpenJDK 11
7576

7677
If you want to run the unit tests or some of the command line examples using a
@@ -770,7 +771,7 @@ TimeZone <>-------- ZoneProcessor ------- ZoneProcessorCache
770771
.----- +----. .---- +-----.
771772
| | | |
772773
BasicZone ExtendedZone BasicZone ExtendedZone
773-
Processor Processor ProcessorCache ZoneProcessor
774+
Processor Processor ProcessorCache ProcessorCache
774775
```
775776

776777
Here is the class declaration of `TimeZone`:
@@ -1620,11 +1621,6 @@ by zoneName or zoneId) into an index into the registry.
16201621
The IANA TZ Database is updated continually. As of this writing, the latest
16211622
stable version is 2019b. When a new version of the database is released, it is
16221623
relatively easy to regenerate the `zonedb/` and `zonedbx/` zoneinfo files.
1623-
However, it is likely that I would delay the release of a new version until the
1624-
corresponding `pytz` package is updated to the latest TZ database version, so
1625-
that the validation test suites pass (See Testing section below). Otherwise, I
1626-
don't have a way to verify that the AceTime library with the new TZ Database
1627-
version is correctly functioning.
16281624

16291625
## Mutations
16301626

@@ -2029,6 +2025,11 @@ void loop() {
20292025
}
20302026
```
20312027

2028+
It has been claimed that the DS1307 and DS3232 RTC chips have exactly same
2029+
interface as DS3231 when accessing the time and date functionality. I don't have
2030+
these chips so I cannot confirm that. Contact @Naguissa
2031+
(https://github.com/Naguissa) for more info.
2032+
20322033
### System Clock
20332034

20342035
The `SystemClock` is a special `Clock` that uses the Arduino built-in `millis()`
@@ -2344,9 +2345,10 @@ timezones.
23442345
23452346
My next idea was to validate AceTime against a known, independently created,
23462347
timezone library that also supports the TZ Database. Currently, I validate
2347-
the AceTime library against 3 other timezone libraries:
2348+
the AceTime library against 4 other timezone libraries:
23482349
23492350
* Python [pytz](https://pypi.org/project/pytz/)
2351+
* Python [dateutil](https://pypi.org/project/python-dateutil)
23502352
* Java 11 [java.time](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/package-summary.html)
23512353
* C++11/14/17 [Hinnant date](https://github.com/HowardHinnant/date)
23522354
@@ -2359,8 +2361,8 @@ found in the future.
23592361
The Python pytz library was a natural choice since the `tzcompiler.py` was
23602362
already written in Python. I created:
23612363
2362-
* [BasicValidationUsingPythonTest](tests/validation/BasicValidationUsingPythonTest/)
2363-
* [ExtendedValidationUsingPythonTest](tests/validation/ExtendedValidationUsingPythonTest/)
2364+
* [BasicPythonTest](tests/validation/BasicPythonTest/)
2365+
* [ExtendedPythonTest](tests/validation/ExtendedPythonTest/)
23642366
23652367
The `pytz` library is used to generate various C++ source code
23662368
(`validation_data.cpp`, `validation_data.h`, `validation_tests.cpp`) which
@@ -2377,31 +2379,45 @@ executed only on desktop-class Linux or MacOS machines through the use of the
23772379
The `pytz` library supports [dates only until
23782380
2038](https://answers.launchpad.net/pytz/+question/262216). It is also tricky to
23792381
match the `pytz` version to the TZ Database version used by AceTime. The
2380-
following combinations have been tested:
2382+
following versions of `pytz` have been tested:
2383+
2384+
* pytz 2019.1, containing TZ Datbase 2019a
2385+
* pytz 2019.2, containing TZ Datbase 2019b
2386+
* pytz 2019.3, containing TZ Datbase 2019c
2387+
2388+
### Python dateutil
2389+
2390+
Validation against the Python dateutil library is similar to pytz. I created:
2391+
2392+
* [BasicDateUtilTest](tests/validation/BasicDateUtilTest/)
2393+
* [ExtendedDateUtilTest](tests/validation/ExtendedDateUtilTest/)
2394+
2395+
Similar to the `pytz` library, the `dateutil` library supports [dates only until
2396+
2038](https://github.com/dateutil/dateutil/issues/462). The
2397+
following versions of `dateutil` have been tested:
23812398
2382-
* TZ Datbase: 2019a; pytz: 2019.1
2383-
* TZ Datbase: 2019b; pytz: 2019.2
2399+
* dateutil 2.8.1, containing TZ Datbase 2019c
23842400
23852401
### Java java.time
23862402
23872403
The Java 11 `java.time` library is not limited to 2038 but supports years
2388-
through the [year 1000000000
2404+
through the [year 1,000,000,000
23892405
(billion)](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/class-use/Instant.html).
2390-
I wrote the [TestDataGenerator.java](tools/java/TestDataGenerator) program to
2391-
generate a `validation_data.cpp` file in exactly the same format as the
2392-
`tzcompiler.py` program, and produced data points from year 2000 to year 2050,
2393-
which is the exact range of years supported by the `zonedb::` and `zonedbx::`
2394-
zoneinfo files.
2406+
I wrote the [TestDataGenerator.java](tools/compare_java/TestDataGenerator.java)
2407+
program to generate a `validation_data.cpp` file in exactly the same format as
2408+
the `tzcompiler.py` program, and produced data points from year 2000 to year
2409+
2050, which is the exact range of years supported by the `zonedb::` and
2410+
`zonedbx::` zoneinfo files.
23952411
23962412
The result is 2 validation programs under `tests/validation`:
23972413
2398-
* [BasicValidationUsingJavaTest](tests/validation/BasicValidationUsingJavaTest/)
2399-
* [ExtendedValidationUsingJavaTest](tests/validation/ExtendedValidationUsingJavaTest/)
2414+
* [BasicJavaTest](tests/validation/BasicJavaTest/)
2415+
* [ExtendedJavaTest](tests/validation/ExtendedJavaTest/)
24002416
24012417
The most difficult part of using Java is figuring out how to install it
24022418
and figuring out which of the many variants of the JDK to use. On Ubuntu 18.04,
24032419
I used `openjdk 11.0.4 2019-07-16` which seems to use TZ Database 2018g. I have
2404-
no recollection how I installed, I think it was something like `$ sudo apt
2420+
no recollection how I installed it, I think it was something like `$ sudo apt
24052421
install openjdk-11-jdk:amd64`.
24062422
24072423
The underlying timezone database used by the `java.time` package seems to be
@@ -2421,14 +2437,15 @@ powerful, complex and difficult to use. I managed to incorporate it into 2 more
24212437
validation tests, and verified that the AceTime library matches the Hinnant date
24222438
library for all timezones from 2000 to 2049 (inclusive):
24232439
2424-
* [BasicValidationUsingHinnantDateTest](tests/validation/BasicValidationUsingHinnantDateTest/)
2425-
* [ExtendedValidationUsingHinnantDateTest](tests/validation/ExtendedValidationUsingHinnantDateTest/)
2440+
* [BasicHinnantDateTest](tests/validation/BasicHinnantDateTest/)
2441+
* [ExtendedHinnantDateTest](tests/validation/ExtendedHinnantDateTest/)
24262442
2427-
I have validated the AceTime library with the following TZ versions against
2428-
the Hinnant date library with the same TZ version:
2429-
2430-
* TZ Database: 2019a
2431-
* TZ Database: 2019b
2443+
I have validated the AceTime library with the Hinnant date library for the
2444+
following TZ Dabase versions:
2445+
* TZ DB version 2019a
2446+
* TZ DB version 2019b
2447+
* TZ DB version 2019c
2448+
* TZ DB version 2020a
24322449
24332450
## Benchmarks
24342451
@@ -2630,10 +2647,10 @@ environment because:
26302647
library.
26312648
26322649
The Hinnant date libraries were invaluable for writing the
2633-
[BasicValidationUsingHinnantDateTest](tests/validation/BasicValidationUsingHinnantDateTest/)
2650+
[BasicHinnantDateTest](tests/validation/BasicHinnantDateTest/)
26342651
and
2635-
[ExtendedValidationUsingHinnantDateTest](tests/validation/ExtendedValidationUsingHinnantDateTest/)
2636-
validation tests (in v0.7) which are the AceTime algorithms to the Hinnant Date
2652+
[ExtendedHinnantDateTest](tests/validation/ExtendedHinnantDateTest/)
2653+
validation tests which compare the AceTime algorithms to the Hinnant Date
26372654
algorithms. For all times zones between the years 2000 until 2050, the AceTime
26382655
UTC offsets (`TimeZone::getUtcOffset()`), timezone abbreviations
26392656
(`TimeZone::getAbbrev()`), and epochSecond conversion to date components
@@ -2644,8 +2661,8 @@ libraries.
26442661
26452662
The [cctz](https://github.com/google/cctz) library from Google is also based on
26462663
the `<chrono>` library. I have not looked at this library closely because I
2647-
assumed that it would fit inside an Arduino controller. Hopefully I will get
2648-
some time to take a closer look in the future.
2664+
assumed that it would *not* fit inside an Arduino controller. Hopefully I will
2665+
get some time to take a closer look in the future.
26492666
26502667
## Bugs and Limitations
26512668
@@ -2703,10 +2720,11 @@ some time to take a closer look in the future.
27032720
not load the entire TZ Database due to memory constraints of most Arduino
27042721
boards.
27052722
* `TimeZone`
2706-
* It might be possible to use a Basic `TimeZone` created using a `zonedb::`
2707-
zoneinfo file, and an Extended `TimeZone` using a `zonedbx::` zoneinfo
2708-
file. However, this is not a configuration that is expected to be used
2709-
often, so it has not been tested well, if at all.
2723+
* It might be possible to use both a Basic `TimeZone` created using a
2724+
`zonedb::` zoneinfo file, and an Extended `TimeZone` using a `zonedbx::`
2725+
zoneinfo file, together in a single program. However, this is not a
2726+
configuration that is expected to be used often, so it has not been tested
2727+
well, if at all.
27102728
* One potential problem is that the equality of two `TimeZone` depends only
27112729
on the `zoneId`, so a Basic `TimeZone` created with a
27122730
`zonedb::kZoneAmerica_Los_Angeles` will be considered equal to an Extended
@@ -2743,8 +2761,11 @@ some time to take a closer look in the future.
27432761
but this is sufficient to support the vast majority of timezones since
27442762
2000.
27452763
* The `zonedb/` files have been filtered to satisfy these constraints.
2746-
* Tested again Python [pytz](https://pypi.org/project/pytz/) from
2764+
* Tested against Python [pytz](https://pypi.org/project/pytz/) from
27472765
2000 until 2038 (limited by pytz).
2766+
* Tested against Python
2767+
[dateutil](https://pypi.org/project/python-dateutil/) from
2768+
2000 until 2038 (limited by dateutil).
27482769
* Tested against Java `java.time` from 2000 to until 2050.
27492770
* Tested against C++11/14/17
27502771
[Hinnant date](https://github.com/HowardHinnant/date) from 2000 until
@@ -2753,12 +2774,15 @@ some time to take a closer look in the future.
27532774
* Has a 1-minute resolution for all time fields.
27542775
* The `zonedbx/` files currently (version 2019b) do not have any timezones
27552776
with 1-minute resolution.
2756-
* Tested again Python [pytz](https://pypi.org/project/pytz/) from
2777+
* Tested against Python [pytz](https://pypi.org/project/pytz/) from
27572778
2000 until 2038 (limited by pytz).
2779+
* Tested against Python
2780+
[dateutil](https://pypi.org/project/python-dateutil/) from
2781+
2000 until 2038 (limited by dateutil).
27582782
* Tested against Java `java.time` from 2000 to until 2050.
27592783
* Tested against [Hinnant date](https://github.com/HowardHinnant/date)
27602784
using 1-minute resolution from 1975 to 2050. See
2761-
[ExtendedValidationUsingHinnantDateTest](tests/validation/ExtendedValidationUsingHinnantDateTest).
2785+
[ExtendedHinnantDateTest](tests/validation/ExtendedHinnantDateTest).
27622786
* `zonedb/` and `zonedbx/` zoneinfo files
27632787
* These statically defined data structures are loaded into flash memory
27642788
using the `PROGMEM` keyword. The vast majority of the data structure
@@ -2831,12 +2855,3 @@ some time to take a closer look in the future.
28312855
SAMD21 Mini Breakout` board. The `MKR Zero` could be using a different
28322856
(more recent?) version of the GCC tool chain. I have not investigated
28332857
this.
2834-
2835-
2836-
## Untested RTC hardware compatibility
2837-
2838-
As DS1307 and DS3232 RTC chip have exactly same interface as DS3231 for used
2839-
features except temperature on DS1307 (this one lacks this functionality),
2840-
this class could be be used to control all of them.
2841-
2842-
Any problem with these RTCs please, contact @Naguissa (https://github.com/Naguissa/AceTime)

docs/doxygen.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "AceTime"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = 1.0
41+
PROJECT_NUMBER = 1.1
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

0 commit comments

Comments
 (0)