From 3ed01f9fd3416a22a2ce4fb7505cf8a8871f3b13 Mon Sep 17 00:00:00 2001 From: Brian Park Date: Tue, 8 Nov 2022 06:55:27 -0800 Subject: [PATCH 01/13] README.md: Update required dependency from AceTime v1.8 to v2.0 (see #15) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cd49ae5..d420798 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ To use the AceTimeClock library, client apps must install the following libraries at a minimum: * AceTimeClock (https://github.com/bxparks/AceTimeClock) -* AceTime v1.8.0 or later (https://github.com/bxparks/AceTime) +* AceTime v2.0 or later (https://github.com/bxparks/AceTime) * AceCommon (https://github.com/bxparks/AceCommon) * AceSorting (https://github.com/bxparks/AceSorting) From c8a8e1b66b5d4edb10b9fbacac57b6bf112599da Mon Sep 17 00:00:00 2001 From: Brian Park Date: Mon, 7 Nov 2022 10:24:17 -0800 Subject: [PATCH 02/13] Stm32F1Rtc.h,Stm32F1Clock.h: Fix incorrect comment, from DR2 to DR1 --- src/ace_time/clock/Stm32F1Clock.h | 6 +++--- src/ace_time/hw/Stm32F1Rtc.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ace_time/clock/Stm32F1Clock.h b/src/ace_time/clock/Stm32F1Clock.h index f686a5f..dafd5e5 100644 --- a/src/ace_time/clock/Stm32F1Clock.h +++ b/src/ace_time/clock/Stm32F1Clock.h @@ -62,9 +62,9 @@ namespace clock { * which holds a single status bit to indicate whether or not the underlying RTC * counter has been initialized to a valid time. The selection of the `DR1` * register, instead of any of the other 9-10 backup registers, is currently - * hardcoded in `Stm32F1Rtc.h`. If that causes a conflict with something else, - * let me know, because this is fixable. We can make that a configurable - * parameter in the Stm32F1Rtc::begin() method. + * hardcoded in the `RTC_INIT_REG` macro in `Stm32F1Rtc.h`. If that causes a + * conflict with something else, let me know, because this is fixable. We can + * make that a configurable parameter in the Stm32F1Rtc::begin() method. */ class Stm32F1Clock: public Clock { public: diff --git a/src/ace_time/hw/Stm32F1Rtc.h b/src/ace_time/hw/Stm32F1Rtc.h index b33d980..1326600 100644 --- a/src/ace_time/hw/Stm32F1Rtc.h +++ b/src/ace_time/hw/Stm32F1Rtc.h @@ -58,8 +58,8 @@ namespace hw { * (hardware abstarction layer) and writes the 32-bit epochSeconds quantity * directly into the `RTC->CNTH` and `RTC->CNTL` registers. * - * The Backup DR2 register is used to hold a single bit, indicating whether or - * not the RTC has been initialized. + * The Backup DR1 register (defined by `RTC_INIT_REG`) is used to hold a single + * bit, indicating whether or not the RTC has been initialized. */ class Stm32F1Rtc { public: From b1edfd53c12019763f31817d5f494afa2eff6d60 Mon Sep 17 00:00:00 2001 From: Brian Park Date: Mon, 7 Nov 2022 10:38:52 -0800 Subject: [PATCH 03/13] Stm{32F1,Rtc}Clock.h: Add note about 2-digit limitation of STM32 hardware, except the F1 which avoids that limitation --- src/ace_time/clock/Stm32F1Clock.h | 8 ++++++++ src/ace_time/clock/StmRtcClock.h | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/ace_time/clock/Stm32F1Clock.h b/src/ace_time/clock/Stm32F1Clock.h index dafd5e5..2fcf297 100644 --- a/src/ace_time/clock/Stm32F1Clock.h +++ b/src/ace_time/clock/Stm32F1Clock.h @@ -58,6 +58,14 @@ namespace clock { * counter on the STM32F1 chip. It bypasses the entire generic RTC and HAL * layers provided by the STM32duino framework. * + * AceTime v2 allows the epoch year of the library to be adjustable by the + * client application, from the year 2000 until the year 10000. The use of a + * simple 32-bit counter in the STM32F1 works to its advantage because it makes + * it allows it work for any the epoch year selected in the AceTime library. + * This is in contrast to the other STM32 processors which use a 2-digit year + * offset from the year 2000. The RTC of those processors will break in the year + * 2100 unless a software fix can be created to work around that limitation. + * * The `Stm32F1Rtc` class uses one additional register, the Backup DR1 register, * which holds a single status bit to indicate whether or not the underlying RTC * counter has been initialized to a valid time. The selection of the `DR1` diff --git a/src/ace_time/clock/StmRtcClock.h b/src/ace_time/clock/StmRtcClock.h index 5095204..1851c73 100644 --- a/src/ace_time/clock/StmRtcClock.h +++ b/src/ace_time/clock/StmRtcClock.h @@ -24,6 +24,19 @@ namespace clock { * [STM32RTC](https://github.com/stm32duino/STM32RTC) library. The STM32RTC * singleton object should be configured using `STM32RTC::getInstance()` in the * global `setup()` function. + * + * AceTime v2 allows the epoch year of the library to be adjustable by the + * client application, from the year 2000 until the year 10000. Unfortunately, + * the STM32 hardware supported by this class (through the dependent STM32RTC + * library) uses a 2-digit year offset from the year 2000. This will break in + * the year 2100 unless a software fix can be created to work around that + * limitation. + * + * Ironically, the STM32F1 chip has a more limited RTC functionality in the + * hardware but that limitation actually works to its advantage so that the F1 + * can be fully compatible with AceTime to its limit of the year 10000 if + * Stm32F1Clock class is used instead of this class. (See notes in + * Stm32F1Clock.h). */ class StmRtcClock: public Clock { public: From 301eb48f2ae2d5828a649c728dc7783fbd52b724 Mon Sep 17 00:00:00 2001 From: Brian Park Date: Mon, 7 Nov 2022 10:46:17 -0800 Subject: [PATCH 04/13] UnixClock.h: Add comment defining the range of validity of the getNow() method --- src/ace_time/clock/UnixClock.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ace_time/clock/UnixClock.h b/src/ace_time/clock/UnixClock.h index 25bb7de..1cd3523 100644 --- a/src/ace_time/clock/UnixClock.h +++ b/src/ace_time/clock/UnixClock.h @@ -25,6 +25,14 @@ class UnixClock: public Clock { /** Setup function that currently does nothing. */ void setup() {} + /** + * @copydoc Clock::getNow() + * + * Since `acetime_t` is a 32-bit integer, this method is valid if the + * current Unix time() is within about +/- 68 years of the current epoch + * being used by the AceTime library, as defined by + * `Epoch::currentEpochYear()`. + */ acetime_t getNow() const override { return time(nullptr) - Epoch::secondsToCurrentEpochFromUnixEpoch64(); } From c79222252e5bc2bd846c2237f6988f098c0160dc Mon Sep 17 00:00:00 2001 From: Brian Park Date: Mon, 7 Nov 2022 10:48:35 -0800 Subject: [PATCH 05/13] EspSntpClock.h: Add comment defining the range of validity of the getNow() method --- src/ace_time/clock/EspSntpClock.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ace_time/clock/EspSntpClock.h b/src/ace_time/clock/EspSntpClock.h index f8ab1b9..d4122eb 100644 --- a/src/ace_time/clock/EspSntpClock.h +++ b/src/ace_time/clock/EspSntpClock.h @@ -47,6 +47,14 @@ class EspSntpClock: public Clock { const char* ntpServer = kDefaultNtpServer, uint32_t timeoutMillis = kDefaultTimeoutMillis); + /** + * @copydoc Clock::getNow() + * + * Since `acetime_t` is a 32-bit integer, this method is valid if the + * current SNTP time() is within about +/- 68 years of the current epoch + * being used by the AceTime library, as defined by + * `Epoch::currentEpochYear()`. + */ acetime_t getNow() const override { return time(nullptr) - Epoch::secondsToCurrentEpochFromUnixEpoch64(); From b5c3eadfdde74f887991599074cfecb8e727048f Mon Sep 17 00:00:00 2001 From: Brian Park Date: Tue, 8 Nov 2022 08:50:36 -0800 Subject: [PATCH 06/13] NtpClock: Fix conversion to AceTime epochSeconds to handle adjust AceTime epoch in v2 --- src/ace_time/clock/NtpClock.cpp | 63 ++++++++++++++++++++---- src/ace_time/clock/NtpClock.h | 46 ++++++++++++++++-- tests/Makefile | 9 +++- tests/NtpClockTest/Makefile | 9 ++++ tests/NtpClockTest/NtpClockTest.ino | 75 +++++++++++++++++++++++++++++ 5 files changed, 186 insertions(+), 16 deletions(-) create mode 100644 tests/NtpClockTest/Makefile create mode 100644 tests/NtpClockTest/NtpClockTest.ino diff --git a/src/ace_time/clock/NtpClock.cpp b/src/ace_time/clock/NtpClock.cpp index c12438b..b431528 100644 --- a/src/ace_time/clock/NtpClock.cpp +++ b/src/ace_time/clock/NtpClock.cpp @@ -132,22 +132,65 @@ acetime_t NtpClock::readResponse() const { // read packet into the buffer mUdp.read(mPacketBuffer, kNtpPacketSize); - // convert four bytes starting at location 40 to a long integer - uint32_t secsSince1900 = (uint32_t) mPacketBuffer[40] << 24; - secsSince1900 |= (uint32_t) mPacketBuffer[41] << 16; - secsSince1900 |= (uint32_t) mPacketBuffer[42] << 8; - secsSince1900 |= (uint32_t) mPacketBuffer[43]; - - acetime_t epochSeconds = (secsSince1900 == 0) - ? kInvalidSeconds - : secsSince1900 - kSecondsSinceNtpEpoch; + // Extract the NTP seconds, an unsigned number of seconds since the NTP epoch + // of 1900-01-01. The NTP timestamp is a 32:32 fixed point number (64-bits + // total) starting at byte 40. The location is determined from the following + // headers (see https://en.wikipedia.org/wiki/User_Datagram_Protocol): + // + // * IP header - 12 bytes + // * UDP header - 8 bytes + // * NTP message packet + // (https://www.meinbergglobal.com/english/info/ntp-packet.htm): + // * flags - 4 bytes + // * Root delay - 4 bytes + // * Root dispersion - 4 bytes + // * Reference identifier - 4 bytes + // * Reference timestamp - 8 bytes (40th byte here) + // * whole seconds (unsigned 32 bits) + // * fractional seconds (unsigned 32 bits, in units of 1/2^32 seconds) + // + // The timestamp is stored in big-endian order. + uint32_t ntpSeconds = (uint32_t) mPacketBuffer[40] << 24; + ntpSeconds |= (uint32_t) mPacketBuffer[41] << 16; + ntpSeconds |= (uint32_t) mPacketBuffer[42] << 8; + ntpSeconds |= (uint32_t) mPacketBuffer[43]; + + // Convert to AceTime epoch (as defined by Epoch::currentEpochYear()). + acetime_t epochSeconds = convertNtpSecondsToAceTimeSeconds(ntpSeconds); #if ACE_TIME_NTP_CLOCK_DEBUG >= 1 - SERIAL_PORT_MONITOR.print(F("NtpClock::readResponse(): epoch=")); + SERIAL_PORT_MONITOR.print(F("NtpClock::readResponse(): ntpSeconds=")); + SERIAL_PORT_MONITOR.print(ntpSeconds); + SERIAL_PORT_MONITOR.print(F("; epochSeconds=")); SERIAL_PORT_MONITOR.println(epochSeconds); #endif + return epochSeconds; } +// NTP epoch is 1900-01-01. Unix epoch is 1970-01-01. GPS epoch is 1980-01-06. +// AceTime v2 epoch is 2050-01-01 by default but is adjustable at runtime. +acetime_t NtpClock::convertNtpSecondsToAceTimeSeconds(uint32_t ntpSeconds) { + // Sometimes the NTP packet is garage and contains 0. Mark that as invalid. + // NOTE: Is this necessary? Let's comment it out for now. + //if (ntpSeconds == 0) return kInvalidSeconds; + + // Shift the NTP seconds to AceTime seconds, using uint32_t operations, + // which performs a shift using modulo 2^32 arithmetic. This maps the entire + // 32-bit range of NTP seconds to the 32-bit AceTime seconds, automatically + // accounting for NTP rollovers, for any AceTime currentEpochYear(). + int32_t daysToCurrentEpochFromNtpEpoch = + Epoch::daysToCurrentEpochFromConverterEpoch() + + kDaysToConverterEpochFromNtpEpoch; + uint32_t secondsToCurrentEpochFromNtpEpoch = (uint32_t) 86400 + * (uint32_t) daysToCurrentEpochFromNtpEpoch; + uint32_t epochSeconds = ntpSeconds - secondsToCurrentEpochFromNtpEpoch; + + // Cast the uint32_t to an int32_t, which has the effect of mapping the upper + // half of the AceTime seconds 32-bit range to its lower half. In other words, + // `if epochSeconds > INT32_MAX: epochSeconds -= 2^32`. + return (int32_t) epochSeconds; +} + void NtpClock::sendNtpPacket(const IPAddress& address) const { #if ACE_TIME_NTP_CLOCK_DEBUG >= 2 uint16_t startTime = millis(); diff --git a/src/ace_time/clock/NtpClock.h b/src/ace_time/clock/NtpClock.h index 42de54a..732a907 100644 --- a/src/ace_time/clock/NtpClock.h +++ b/src/ace_time/clock/NtpClock.h @@ -30,7 +30,24 @@ namespace clock { * So every now and then, it can take 5-6 seconds for the call to return, * blocking everything (e.g. display refresh, button clicks) until it times out. * - * TODO: Create a version that uses a non-blocking DNS look up. + * NTP seconds is an unsigned 32-bit integer offset from the NTP epoch of + * 1900-01-01. It rolls over every 136 years, with the first rollover happening + * just after 2036-02-07 06:28:16 UTC. Each NTP rollover enters into the next + * NTP Era. I have seen documentation that says that NTP v4 packets contain the + * NTP era number but I have yet to find information on how to extract that + * number. So currently this class ignores the NTP Era from the NTP packet. + * Instead, the NTP Era is automatically inferred to be compatible with the + * currently defined AceTime epoch, as described next. + * + * The AceTime seconds is a signed 32-bit integer with a range of 136 years + * centered around the `Epoch::currentEpochYear()`. This class converts NTP + * seconds to AceTime seconds by mapping the the AceTime seconds range onto the + * NTP seconds range, straddling any NTP era necessary to meet the AceTime + * seconds range. For example, for the default AceTime v2 epoch of 2050, the NTP + * seconds will be interpreted to be from 1982 to 2118, crossing from NTP era 0 + * to NTP era 1. If the AceTime epoch is changed to 2150, then the NTP seconds + * will be interpreted to be from 2082 to 2218, crossing from NTP era 1 to NTP + * era 2. * * Warning: If you are using an ESP8266, AND you are using the `analogRead()` * function, calling `analogRead()` too quickly will cause the WiFi connection @@ -38,12 +55,15 @@ namespace clock { * the disconnect. See https://github.com/esp8266/Arduino/issues/1634 and * https://github.com/esp8266/Arduino/issues/5083. The solution is to add a * slightly delay between calls to analogRead(). I don't know what the minimum - * value should be, but using a 10ms delay seems to work for me. + * value should be, but using a 10ms delay (i.e. no faster than 100 times a + * second) seems to work for me. * * Borrowed from * https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/NTPClient/NTPClient.ino * and * https://github.com/PaulStoffregen/Time/blob/master/examples/TimeNTP/TimeNTP.ino + * + * TODO: Create a version that uses a non-blocking DNS look up. */ class NtpClock: public Clock { public: @@ -105,15 +125,31 @@ class NtpClock: public Clock { acetime_t readResponse() const override; + /** + * Convert an NTP seconds to AceTime seconds relative to the current AceTime + * epoch defined by `Epoch::currentEpochYear()`. Since NTP epoch is + * 1900-01-01 and is due to rollover in 2036-02-07 06:28:16, this function + * automatically accounts for the rollover of NTP seconds by shifting the + * NTP seconds into AceTime seconds using modulo 2^32 unsigned operations. + * + * The result of this function is that it takes the entire 32-bit range of + * the (signed) AceTime seconds (centered around the `currentEpochYear()`, + * and overlays it on top of the (unsigned) NTP seconds time line (with + * rollovers into new NTP eras every 2^32 seconds), and converts each NTP + * seconds (regardless of its NTP era) into its corresonding AceTime + * seconds. + */ + static acetime_t convertNtpSecondsToAceTimeSeconds(uint32_t ntpSeconds); + private: /** NTP time is in the first 48 bytes of message. */ static const uint8_t kNtpPacketSize = 48; /** - * Number of seconds between NTP epoch (1900-01-01T00:00:00Z) and - * AceTime epoch (2000-01-01T00:00:00Z). + * Number of days between NTP epoch (1900-01-01T00:00:00Z) and + * AceTime Epoch Converter epoch (2000-01-01T00:00:00Z). */ - static const uint32_t kSecondsSinceNtpEpoch = 3155673600; + static const int32_t kDaysToConverterEpochFromNtpEpoch = 36524; /** Send an NTP request to the time server at the given address. */ void sendNtpPacket(const IPAddress& address) const; diff --git a/tests/Makefile b/tests/Makefile index 5529273..a179b91 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,8 +1,15 @@ +# We have both EPOXY_CORE_AVR and EPOXY_CORE_ESP*266 tests here, so we must +# recompile the object files when switching between the two. The easiest way to +# do that, while preserving the *.out file for each test to allow the +# 'runtests' target to suceed, is to perform a 'make clean' before compiling +# each test. It's a bit inefficient but there are only 3 tests in this +# directory. tests: set -e; \ for i in *Test/Makefile; do \ echo '==== Making:' $$(dirname $$i); \ - $(MAKE) -C $$(dirname $$i) -j; \ + $(MAKE) -C $$(dirname $$i) -j4 clean; \ + $(MAKE) -C $$(dirname $$i) -j4; \ done runtests: diff --git a/tests/NtpClockTest/Makefile b/tests/NtpClockTest/Makefile new file mode 100644 index 0000000..702ec4a --- /dev/null +++ b/tests/NtpClockTest/Makefile @@ -0,0 +1,9 @@ +# See https://github.com/bxparks/EpoxyDuino for documentation about this +# Makefile to compile and run Arduino programs natively on Linux or MacOS. + +APP_NAME := NtpClockTest +ARDUINO_LIBS := AUnit AceCommon AceSorting AceTime AceTimeClock \ + EpoxyMockSTM32RTC ESP8266WiFi +ARDUINO_LIB_DIRS := $(abspath ../../..) $(abspath ../../../EspMock/libraries) +EPOXY_CORE := EPOXY_CORE_ESP8266 +include ../../../EpoxyDuino/EpoxyDuino.mk diff --git a/tests/NtpClockTest/NtpClockTest.ino b/tests/NtpClockTest/NtpClockTest.ino new file mode 100644 index 0000000..86c19c4 --- /dev/null +++ b/tests/NtpClockTest/NtpClockTest.ino @@ -0,0 +1,75 @@ +#line 2 "NtpClockTest.ino" + +#include +#include + +using namespace aunit; +using ace_time::LocalDate; +using ace_time::clock::NtpClock; + +static const int64_t kSecondsTo1900From1970 = -2208988800; +static const int64_t kSecondsTo2000From1970 = 946684800; +static const int64_t kSecondsTo2050From1970 = 2524608000; +static const int64_t kSecondsTo2100From1970 = 4102444800; + +// Largest NTP seconds value for NTP Era 0, expressed as seconds from 1970. +// 2,085,978,495 = 2036-02-07 06:28:15 +static const int64_t kSecondsToNtpEra0MaxFrom1970 = + (UINT32_MAX) + kSecondsTo1900From1970; + +test(NtpClockTest, convertNtpSecondsToAceTimeSeconds) { + // NTP epoch of 0 is sometimes returned by invalid packets, so NtpClock + // returns kInvalidEpochSeconds to indicate an error. Unfortunately, 0 also + // corresponds to the first value of the new NTP era after rollover in the + // year 2036, in other words, 0 also represents 2036-02-07 06:28:16. The + // AceTimeClock library will ignore that one second for sync'ing purposes. + // + // NOTE: Commented out pending whether this check is required. + // assertEqual( + // LocalDate::kInvalidEpochSeconds, + // NtpClock::convertNtpSecondsToAceTimeSeconds(0)); + + // NTP seconds of UINT32_MAX is interpreted be in NTP era 0 and represents + // 2036-02-07 06:28:15. + assertEqual( + (int32_t) (kSecondsToNtpEra0MaxFrom1970 - kSecondsTo2050From1970), + NtpClock::convertNtpSecondsToAceTimeSeconds(UINT32_MAX)); + + // NTP seconds of 1 is interpreted be in NTP era 1, after rolling over in + // 2036, and represents 2036-02-07 06:28:17. + assertEqual( + (int32_t) (kSecondsToNtpEra0MaxFrom1970 - kSecondsTo2050From1970 + 2), + NtpClock::convertNtpSecondsToAceTimeSeconds(1)); + + // 2000-01-01 (AceTime v1 epoch) is interpreted to be in NTP era 0, + // before the NTP roll over in 2036. + assertEqual( + (int32_t) (kSecondsTo2000From1970 - kSecondsTo2050From1970), + NtpClock::convertNtpSecondsToAceTimeSeconds((uint32_t) + (kSecondsTo2000From1970 - kSecondsTo1900From1970))); + + // 2050-01-01 (AceTime v2 epoch) is interpreted to be in NTP era 1, since it + // is after 2036. + assertEqual((int32_t) 0, + NtpClock::convertNtpSecondsToAceTimeSeconds((uint32_t) + (kSecondsTo2050From1970 - kSecondsTo1900From1970))); + + // 2100-01-01 (50 years past v2 epoch) is interpreted to in NTP Era 1. + assertEqual((int32_t) (kSecondsTo2100From1970 - kSecondsTo2050From1970), + NtpClock::convertNtpSecondsToAceTimeSeconds((uint32_t) + (kSecondsTo2100From1970 - kSecondsTo1900From1970))); +} + +//--------------------------------------------------------------------------- + +void setup() { +#if ! defined(EPOXY_DUINO) + delay(1000); // wait to prevent garbage on SERIAL_PORT_MONITOR +#endif + SERIAL_PORT_MONITOR.begin(115200); + while (!SERIAL_PORT_MONITOR); // Leonardo/Micro +} + +void loop() { + TestRunner::run(); +} From c81200fdc41be460999d25000cbcb77ffab9686d Mon Sep 17 00:00:00 2001 From: Brian Park Date: Tue, 8 Nov 2022 10:08:22 -0800 Subject: [PATCH 07/13] README.md: Add range of validity of getNow() for each Clock implementation --- CHANGELOG.md | 6 +++ README.md | 95 ++++++++++++++++++++++++----------- src/ace_time/clock/NtpClock.h | 13 ++--- 3 files changed, 78 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c424c4..0b44a75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Changelog * Unreleased + * Fix `NtpClock` to handle the `uint32_t` overflow of NTP seconds, with the + first one occuring just after 2036-02-07 06:28:15 UTC. + * Review and document the range of validity of the `getNow()` seconds of + various `Clock` classes. See [Bugs and Limitations](README.md#Bugs). + * Update various sections of README.md to account for the change of AceTime + epoch from 2000-01-01 (v1) to 2050-01-01 (v2). * v1.2.1 (2022-11-06) * Fix incorrect reference to `LocalDate::secondsToCurrentEpochFromUnixEpoch64` instead of diff --git a/README.md b/README.md index d420798..e08c1e7 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,16 @@ [![AUnit Tests](https://github.com/bxparks/AceTimeClock/actions/workflows/aunit_tests.yml/badge.svg)](https://github.com/bxparks/AceTimeClock/actions/workflows/aunit_tests.yml) -The AceTimeClock library provides various `Clock` classes to retrieve and -synchronize the real time clock from different sources. The different clock -sources are converted to a 32-bit signed integer (`int32_t`) that -represents the number of seconds since a fixed point in the past called the -**epoch**. The epoch in this library is defined to be 2000-01-01T00:00:00 UTC -for compatibility with the [AceTime](https://github.com/bxparks/AceTime) -companion library. +The AceTimeClock library is a companion library to the +[AceTime](https://github.com/bxparks/AceTime) library. The AceTime library +provides classes to convert between the "epoch seconds" and human-readable +date/time fields. It also supports calculating DST shifts for all timezones in +the IANA TZ database. This library provides various `Clock` classes to retrieve +and synchronize the "epoch seconds" from external sources, such as an NTP client +(ESP8266, ESP32), an SNTP client (ESP8266, ESP32) , the STM32 RTC clock (STM32), +and the DS3231 RTC chip. The different clock sources are converted to the +`int32_t` epoch seconds used by the AceTime library, using the same AceTime +epoch of 2050-01-01 UTC as defined by `ace_time::Epoch::currentEpochYear()`. The following clock sources are supported: @@ -40,11 +43,8 @@ the `system_tick()` function exactly once a second. On the SAMD21 and Teensy platforms, the `time.h` header file does not exist. This library was part of the [AceTime](https://github.com/bxparks/AceTime) -library, but extracted into a separate library to manage the complexity of both -libraries. The AceTime library provides the mechanism for converting the epoch -seconds from AceTimeClock into human-readable date and time in different time -zones. AceTimeClock currently has a dependency on AceTime, but that may go away -in the future. +library, but extracted into a separate library in AceTime v1.8 to manage the +complexity of both libraries. This library can be an alternative to the Arduino Time (https://github.com/PaulStoffregen/Time) library. @@ -482,7 +482,7 @@ void setup() { Wire.begin(); wireInterface.begin(); dsClock.setup(); - dsClock.setNow(0); // 2000-01-01T00:00:00Z + dsClock.setNow(0); // 2050-01-01T00:00:00Z } void loop() { @@ -533,10 +533,6 @@ class StmRtcClock: public Clock { } ``` -This class is relatively new (added in v1.4) and may require more extensive -testing. I have done some rough testing on the STM32F103 (Blue Pill) and the -STM32F411 (Black Pill) dev boards. - The `StmRtcClock` uses the `STM32RTC::getInstance()` singleton instance from the `STM32RTC` library which should be configured in the global `setup()` function like this (see @@ -601,6 +597,10 @@ the following issues: The bug was fixed with [STM32RTC#58](https://github.com/stm32duino/STM32RTC/pull/58). +The RTC module on most (all?) STM32 processors use a 2-digit year offset from +the year 2000. Therefore, the `acetime_t` returned by `Stm32Clock::getNow()` is +valid from the year 2000 until the year 2100. + ### Stm32F1Clock Class @@ -679,6 +679,10 @@ accurate to better than 1 second per 48 hours. See for example: * https://github.com/rogerclarkmelbourne/Arduino_STM32/issues/572 * https://www.stm32duino.com/viewtopic.php?t=143 +Unlike other STM32 processors, the RTC module on the STM32F1 uses a 32-bit +counter, instead of a 2-digit year. The `Stm32F1Clock` takes advantage of this +by mapping this counter directly to the `acetime_t` type. So the `Stm32F1Clock::getNow()` method should be valid for the entire 136 year range of `acetime_t`, from the year 1982 until the year 2118. + ## NtpClock Class @@ -793,6 +797,16 @@ See the following examples for more details: public repository like GitHub because they will become public to anyone. Even if you delete the commit, they can be retrieved from the git history. +The [NTP](https://en.wikipedia.org/wiki/Network_Time_Protocol) counts the number +of seconds from its epoch of 1900-01-01 00:00:00 UTC, using a 32-bit unsigned +integer. Each time the 32-bit number overflows, the NTP clock enters a new era. +The first overflow will happen just after 2036-02-07 06:28:15 UTC. The +`NtpClock` class has been updated to handle this overflow by mapping the +full 32-bit range of `acetime_t` relative to the AceTime epoch to the +full 32-bit range of the NTP seconds straddling the appropriate NTP eras. See +the doc comments in [NtpClock.h](src/ace_time/clock/DS3231Clock.h) for more +details. + ### ESP SNTP Clock Class @@ -834,7 +848,7 @@ DST offset are set to 0). The `setup()` method returns `true` on success, The `getNow()` method calls the built-in `time()` function and converts the 64-bit `time_t` Unix epoch seconds used on the ESP8266 and ESP32 platforms to the 32-bit `acetime_t` epoch seconds used by the AceTime library. In the current -version of AceTime, this is valid until 2068-01-19 03:14:07 UTC. +version of AceTime, this is valid from 1982 to 2118. The SNTP client apparently performs automatic synchronization of the `time()` function every 1 hour, but the only documentation for this that I can find is in @@ -842,8 +856,8 @@ this [NTP-TZ-DST](https://github.com/esp8266/Arduino/tree/master/libraries/esp8266/examples/NTP-TZ-DST) example file. -**Note**: You use the ESP SNTP service with the AceTime library directly without -going through the `EspSntpClock` class. See +**Note**: You can use the ESP SNTP service with the AceTime library directly +without going through the `EspSntpClock` class. See [AceTime/examples/EspTime](https://github.com/bxparks/AceTime/tree/develop/examples/EspTime). @@ -1730,17 +1744,38 @@ them. ## Bugs and Limitations +* AceTimeClock epoch is the same as AceTime epoch + * The AceTime epoch defined by `ace_time::Epoch::currentEpochYear()`, which + is 2050-01-01 00:00:00 UTC by default as of AceTime v2. + * If the AceTime epoch is changed, then the interpretation of the `getNow()` + and `setNow()` methods of this library will also be changed. +* `DS3231Clock` + * Uses a 2-digit year, so the `getNow()` is valid from 2000 until 2100. + * If the AceTime epoch is changed so that this range is no longer covered by + `acetime_t`, then the result is unpredictable. * `NtpClock` - * The `NtpClock` on an ESP8266 calls `WiFi.hostByName()` to resolve - the IP address of the NTP server. Unfortunately, when I tested this - library, it seems to be a blocking call (later versions may have fixed - this). When the DNS resolver is working properly, this call returns in - ~10ms or less. But sometimes, the DNS resolver seems to get into a state - where it takes 4-5 **seconds** to time out. Even if you use AceRoutine - coroutines, the entire program will block for those 4-5 seconds. - * [NTP](https://en.wikipedia.org/wiki/Network_Time_Protocol) uses an epoch - of 1900-01-01T00:00:00Z, with 32-bit unsigned integer as the seconds - counter. It will overflow just after 2036-02-07T06:28:15Z. + * Calls `WiFi.hostByName()` to resolve the IP address which seems to be a + blocking call. + * When the DNS resolver is working properly, this call returns in ~10ms + or less. + * Occasionally, the DNS resolver takes 4-5 **seconds** to time out. + When this happens, the entire program will block for those 4-5 + seconds. + * Supports the full range of `acetime_t`, from 1982 to 2116, by accounting + for the NTP second rollover using the current AceTime epoch to + automatically select the appropriate NTP eras. +* `EspSntpClock` + * Valid for the full range of `acetime_t` from 1982 to 2116, + assuming the SNTP client provided by the ESP8266 and ESP32 libraries uses + the `int64_t` type properly. +* `StmRtcClock` + * Limited from 2000 until 2100 due to the 2-digit year used by the RTC + module on STM32 chips. + * If the AceTime epoch is changed so that this range is no longer covered by + `acetime_t`, then the result is unpredictable. +* `Stm32F1Clock` + * Supports the full range of `acetime_t`, from 1982 to 2116, because this + class directly accesses the 32-bit counter used by the STM32F1. ## License diff --git a/src/ace_time/clock/NtpClock.h b/src/ace_time/clock/NtpClock.h index 732a907..de22db2 100644 --- a/src/ace_time/clock/NtpClock.h +++ b/src/ace_time/clock/NtpClock.h @@ -32,12 +32,12 @@ namespace clock { * * NTP seconds is an unsigned 32-bit integer offset from the NTP epoch of * 1900-01-01. It rolls over every 136 years, with the first rollover happening - * just after 2036-02-07 06:28:16 UTC. Each NTP rollover enters into the next + * just after 2036-02-07 06:28:15 UTC. Each NTP rollover enters into the next * NTP Era. I have seen documentation that says that NTP v4 packets contain the * NTP era number but I have yet to find information on how to extract that * number. So currently this class ignores the NTP Era from the NTP packet. - * Instead, the NTP Era is automatically inferred to be compatible with the - * currently defined AceTime epoch, as described next. + * Instead, the NTP Era is automatically inferred to be the ones that completely + * span the currently defined AceTime epoch range, as described next. * * The AceTime seconds is a signed 32-bit integer with a range of 136 years * centered around the `Epoch::currentEpochYear()`. This class converts NTP @@ -128,9 +128,10 @@ class NtpClock: public Clock { /** * Convert an NTP seconds to AceTime seconds relative to the current AceTime * epoch defined by `Epoch::currentEpochYear()`. Since NTP epoch is - * 1900-01-01 and is due to rollover in 2036-02-07 06:28:16, this function - * automatically accounts for the rollover of NTP seconds by shifting the - * NTP seconds into AceTime seconds using modulo 2^32 unsigned operations. + * 1900-01-01 and is due to rollover just after 2036-02-07 06:28:15, this + * function automatically accounts for the rollover of NTP seconds by + * shifting the NTP seconds into AceTime seconds using modulo 2^32 unsigned + * operations. * * The result of this function is that it takes the entire 32-bit range of * the (signed) AceTime seconds (centered around the `currentEpochYear()`, From cb4008224eb1e6cf6e8227eec42488e1acaf8309 Mon Sep 17 00:00:00 2001 From: Brian Park Date: Tue, 8 Nov 2022 10:48:28 -0800 Subject: [PATCH 08/13] Bump version to 1.2.2 --- CHANGELOG.md | 1 + README.md | 2 +- docs/doxygen.cfg | 2 +- library.properties | 2 +- src/AceTimeClock.h | 4 ++-- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b44a75..a098823 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog * Unreleased +* v1.2.2 (2022-11-08) * Fix `NtpClock` to handle the `uint32_t` overflow of NTP seconds, with the first one occuring just after 2036-02-07 06:28:15 UTC. * Review and document the range of validity of the `getNow()` seconds of diff --git a/README.md b/README.md index e08c1e7..8886c60 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ complexity of both libraries. This library can be an alternative to the Arduino Time (https://github.com/PaulStoffregen/Time) library. -**Version**: v1.2.1 (2022-11-06) +**Version**: v1.2.2 (2022-11-08) **Changelog**: [CHANGELOG.md](CHANGELOG.md) diff --git a/docs/doxygen.cfg b/docs/doxygen.cfg index 2d7ae05..0b7581c 100644 --- a/docs/doxygen.cfg +++ b/docs/doxygen.cfg @@ -38,7 +38,7 @@ PROJECT_NAME = AceTimeClock # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.2.1 +PROJECT_NUMBER = 1.2.2 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/library.properties b/library.properties index b3690aa..eb8982a 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=AceTimeClock -version=1.2.1 +version=1.2.2 author=Brian T. Park maintainer=Brian T. Park sentence=Clock classes for Arduino that can synchronize from an NTP server or an RTC chip. diff --git a/src/AceTimeClock.h b/src/AceTimeClock.h index eccabf4..abf7a18 100644 --- a/src/AceTimeClock.h +++ b/src/AceTimeClock.h @@ -37,7 +37,7 @@ #endif // #if defined(ARDUINO_ARCH_STM32) || defined(EPOXY_DUINO) // Version format: xxyyzz == "xx.yy.zz" -#define ACE_TIME_CLOCK_VERSION 10201 -#define ACE_TIME_CLOCK_VERSION_STRING "1.2.1" +#define ACE_TIME_CLOCK_VERSION 10202 +#define ACE_TIME_CLOCK_VERSION_STRING "1.2.2" #endif From ed11624940b785f13b470d8e726f7dad3099c2e8 Mon Sep 17 00:00:00 2001 From: Brian Park Date: Tue, 8 Nov 2022 11:16:11 -0800 Subject: [PATCH 09/13] MemoryBenchmark: Regenerate for v1.2.2 --- examples/MemoryBenchmark/README.md | 145 +++++++++++--------- examples/MemoryBenchmark/esp32.txt | 22 +-- examples/MemoryBenchmark/esp8266.txt | 16 +-- examples/MemoryBenchmark/generate_readme.py | 39 ++++-- examples/MemoryBenchmark/micro.txt | 14 +- examples/MemoryBenchmark/nano.txt | 14 +- examples/MemoryBenchmark/stm32.txt | 22 +-- examples/MemoryBenchmark/teensy32.txt | 18 +-- 8 files changed, 162 insertions(+), 128 deletions(-) diff --git a/examples/MemoryBenchmark/README.md b/examples/MemoryBenchmark/README.md index 3efc647..fcc817c 100644 --- a/examples/MemoryBenchmark/README.md +++ b/examples/MemoryBenchmark/README.md @@ -5,7 +5,7 @@ memory and static RAM sizes were recorded. The `FEATURE_BASELINE` selection is the baseline, and its memory usage numbers are subtracted from the subsequent `FEATURE_*` memory usage. -**Version**: AceTimeClock v1.1.0 +**Version**: AceTimeClock v1.2.2 **DO NOT EDIT**: This file was auto-generated using `make README.md`. @@ -83,11 +83,28 @@ ASCII table. * Using `` through `StmRtcClock` consumes an extra ~4kB of flash compared to using `Stm32F1Clock`. +**v1.2.2** + +* Upgrade tool chains + * Arduino CLI from 0.27.1 + * STM32duino from 2.3.0 + * AVR Core from 1.8.4 to 1.8.5 + * ESP32 Core from 2.0.2 to 2.0.5 + * Teensyduino from 1.56 to 1.57 +* Upgrade to AceTime v2.0 + * Update `NtpClock` to use AceTime `Epoch::currentEpochYear()` +* Many `Clock` classes increase in flash size + * AVR: 100-400 bytes + * ESP8266: 50-150 bytes + * Most likely due to the adjustable AceTime epoch + (`Epoch::currentEpochYear()`), and the change from `int8_t` year to + `int16_t` year. + ## Arduino Nano * 16MHz ATmega328P -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 -* Arduino AVR Boards 1.8.4 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 +* Arduino AVR Boards 1.8.5 ``` +----------------------------------------------------------------------+ @@ -95,17 +112,17 @@ ASCII table. |----------------------------------------+--------------+--------------| | Baseline | 496/ 17 | 0/ 0 | |----------------------------------------+--------------+--------------| -| DS3231Clock | 4828/ 259 | 4332/ 242 | -| DS3231Clock | 3282/ 49 | 2786/ 32 | -| DS3231Clock | 2598/ 43 | 2102/ 26 | +| DS3231Clock | 4958/ 259 | 4462/ 242 | +| DS3231Clock | 3412/ 49 | 2916/ 32 | +| DS3231Clock | 2742/ 43 | 2246/ 26 | |----------------------------------------+--------------+--------------| | SystemClockLoop | 1016/ 72 | 520/ 55 | -| SystemClockLoop+1 Basic zone | 6876/ 262 | 6380/ 245 | -| SystemClockLoop+1 Extended zone | 10318/ 296 | 9822/ 279 | +| SystemClockLoop+1 Basic zone | 7102/ 262 | 6606/ 245 | +| SystemClockLoop+1 Extended zone | 10702/ 296 | 10206/ 279 | |----------------------------------------+--------------+--------------| | SystemClockCoroutine | 1820/ 100 | 1324/ 83 | -| SystemClockCoroutine+1 Basic zone | 7650/ 290 | 7154/ 273 | -| SystemClockCoroutine+1 Extended zone | 11092/ 324 | 10596/ 307 | +| SystemClockCoroutine+1 Basic zone | 7876/ 290 | 7380/ 273 | +| SystemClockCoroutine+1 Extended zone | 11476/ 324 | 10980/ 307 | +----------------------------------------------------------------------+ ``` @@ -113,7 +130,7 @@ ASCII table. ## Sparkfun Pro Micro * 16 MHz ATmega32U4 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 * SparkFun AVR Boards 1.1.13 ``` @@ -122,17 +139,17 @@ ASCII table. |----------------------------------------+--------------+--------------| | Baseline | 3490/ 157 | 0/ 0 | |----------------------------------------+--------------+--------------| -| DS3231Clock | 7818/ 405 | 4328/ 248 | -| DS3231Clock | 6358/ 195 | 2868/ 38 | -| DS3231Clock | 5560/ 189 | 2070/ 32 | +| DS3231Clock | 7948/ 405 | 4458/ 248 | +| DS3231Clock | 6488/ 195 | 2998/ 38 | +| DS3231Clock | 5704/ 189 | 2214/ 32 | |----------------------------------------+--------------+--------------| | SystemClockLoop | 3972/ 212 | 482/ 55 | -| SystemClockLoop+1 Basic zone | 9830/ 400 | 6340/ 243 | -| SystemClockLoop+1 Extended zone | 13272/ 434 | 9782/ 277 | +| SystemClockLoop+1 Basic zone | 10056/ 400 | 6566/ 243 | +| SystemClockLoop+1 Extended zone | 13656/ 434 | 10166/ 277 | |----------------------------------------+--------------+--------------| | SystemClockCoroutine | 4776/ 240 | 1286/ 83 | -| SystemClockCoroutine+1 Basic zone | 10604/ 428 | 7114/ 271 | -| SystemClockCoroutine+1 Extended zone | 14046/ 462 | 10556/ 305 | +| SystemClockCoroutine+1 Basic zone | 10830/ 428 | 7340/ 271 | +| SystemClockCoroutine+1 Extended zone | 14430/ 462 | 10940/ 305 | +----------------------------------------------------------------------+ ``` @@ -140,28 +157,28 @@ ASCII table. ## STM32 Blue Pill * STM32F103C8, 72 MHz ARM Cortex-M3 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 -* STM32duino 2.2.0 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 +* STM32duino 2.3.0 ``` +----------------------------------------------------------------------+ | Functionality | flash/ ram | delta | |----------------------------------------+--------------+--------------| -| Baseline | 21892/ 3544 | 0/ 0 | +| Baseline | 21348/ 3560 | 0/ 0 | |----------------------------------------+--------------+--------------| -| DS3231Clock | 30412/ 3792 | 8520/ 248 | -| DS3231Clock | 25956/ 3612 | 4064/ 68 | +| DS3231Clock | 31940/ 3836 | 10592/ 276 | +| DS3231Clock | 25348/ 3632 | 4000/ 72 | |----------------------------------------+--------------+--------------| -| StmRtcClock | 26456/ 3616 | 4564/ 72 | -| Stm32F1Clock | 22476/ 3580 | 584/ 36 | +| StmRtcClock | 25840/ 3640 | 4492/ 80 | +| Stm32F1Clock | 21936/ 3596 | 588/ 36 | |----------------------------------------+--------------+--------------| -| SystemClockLoop | 22332/ 3628 | 440/ 84 | -| SystemClockLoop+1 Basic zone | 26596/ 3628 | 4704/ 84 | -| SystemClockLoop+1 Extended zone | 28580/ 3628 | 6688/ 84 | +| SystemClockLoop | 21792/ 3644 | 444/ 84 | +| SystemClockLoop+1 Basic zone | 26216/ 3648 | 4868/ 88 | +| SystemClockLoop+1 Extended zone | 28256/ 3648 | 6908/ 88 | |----------------------------------------+--------------+--------------| -| SystemClockCoroutine | 22808/ 3660 | 916/ 116 | -| SystemClockCoroutine+1 Basic zone | 27068/ 3660 | 5176/ 116 | -| SystemClockCoroutine+1 Extended zone | 29052/ 3660 | 7160/ 116 | +| SystemClockCoroutine | 22268/ 3676 | 920/ 116 | +| SystemClockCoroutine+1 Basic zone | 26688/ 3680 | 5340/ 120 | +| SystemClockCoroutine+1 Extended zone | 28732/ 3680 | 7384/ 120 | +----------------------------------------------------------------------+ ``` @@ -169,7 +186,7 @@ ASCII table. ## ESP8266 * NodeMCU 1.0, 80MHz ESP8266 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 * ESP8266 Boards 3.0.2 ``` @@ -178,19 +195,19 @@ ASCII table. |----------------------------------------+--------------+--------------| | Baseline | 260109/27896 | 0/ 0 | |----------------------------------------+--------------+--------------| -| DS3231Clock | 269505/28556 | 9396/ 660 | -| DS3231Clock | 267297/28172 | 7188/ 276 | +| DS3231Clock | 269573/28560 | 9464/ 664 | +| DS3231Clock | 267365/28176 | 7256/ 280 | |----------------------------------------+--------------+--------------| -| NtpClock | 269101/28212 | 8992/ 316 | -| EspSntpClock | 266601/28236 | 6492/ 340 | +| NtpClock | 269137/28216 | 9028/ 320 | +| EspSntpClock | 266637/28240 | 6528/ 344 | |----------------------------------------+--------------+--------------| | SystemClockLoop | 264809/28124 | 4700/ 228 | -| SystemClockLoop+1 Basic zone | 271329/28684 | 11220/ 788 | -| SystemClockLoop+1 Extended zone | 273873/28828 | 13764/ 932 | +| SystemClockLoop+1 Basic zone | 271365/28688 | 11256/ 792 | +| SystemClockLoop+1 Extended zone | 273957/28832 | 13848/ 936 | |----------------------------------------+--------------+--------------| | SystemClockCoroutine | 265353/28156 | 5244/ 260 | -| SystemClockCoroutine+1 Basic zone | 271889/28716 | 11780/ 820 | -| SystemClockCoroutine+1 Extended zone | 274433/28860 | 14324/ 964 | +| SystemClockCoroutine+1 Basic zone | 271925/28720 | 11816/ 824 | +| SystemClockCoroutine+1 Extended zone | 274517/28864 | 14408/ 968 | +----------------------------------------------------------------------+ ``` @@ -198,28 +215,28 @@ ASCII table. ## ESP32 * ESP32-01 Dev Board, 240 MHz Tensilica LX6 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 -* ESP32 Boards 2.0.2 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 +* ESP32 Boards 2.0.5 ``` +----------------------------------------------------------------------+ | Functionality | flash/ ram | delta | |----------------------------------------+--------------+--------------| -| Baseline | 204513/16060 | 0/ 0 | +| Baseline | 211077/16056 | 0/ 0 | |----------------------------------------+--------------+--------------| -| DS3231Clock | 243921/17284 | 39408/ 1224 | -| DS3231Clock | 220449/16588 | 15936/ 528 | +| DS3231Clock | 254241/16712 | 43164/ 656 | +| DS3231Clock | 236477/16384 | 25400/ 328 | |----------------------------------------+--------------+--------------| -| NtpClock | 622433/37708 | 417920/21648 | -| EspSntpClock | 635397/37592 | 430884/21532 | +| NtpClock | 662693/37816 | 451616/21760 | +| EspSntpClock | 675649/37684 | 464572/21628 | |----------------------------------------+--------------+--------------| -| SystemClockLoop | 216297/16452 | 11784/ 392 | -| SystemClockLoop+1 Basic zone | 221601/16452 | 17088/ 392 | -| SystemClockLoop+1 Extended zone | 223981/16452 | 19468/ 392 | +| SystemClockLoop | 226601/16368 | 15524/ 312 | +| SystemClockLoop+1 Basic zone | 232041/16384 | 20964/ 328 | +| SystemClockLoop+1 Extended zone | 234405/16384 | 23328/ 328 | |----------------------------------------+--------------+--------------| -| SystemClockCoroutine | 216929/16484 | 12416/ 424 | -| SystemClockCoroutine+1 Basic zone | 222229/16484 | 17716/ 424 | -| SystemClockCoroutine+1 Extended zone | 224593/16484 | 20080/ 424 | +| SystemClockCoroutine | 227213/16400 | 16136/ 344 | +| SystemClockCoroutine+1 Basic zone | 232649/16416 | 21572/ 360 | +| SystemClockCoroutine+1 Extended zone | 235017/16416 | 23940/ 360 | +----------------------------------------------------------------------+ ``` @@ -231,25 +248,25 @@ usage by objects. ## Teensy 3.2 * 96 MHz ARM Cortex-M4 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 -* Teensyduino 1.56 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 +* Teensyduino 1.57 ``` +----------------------------------------------------------------------+ | Functionality | flash/ ram | delta | |----------------------------------------+--------------+--------------| -| Baseline | 10200/ 4160 | 0/ 0 | +| Baseline | 10076/ 4160 | 0/ 0 | |----------------------------------------+--------------+--------------| -| DS3231Clock | 17456/ 4992 | 7256/ 832 | -| DS3231Clock | 19192/ 4172 | 8992/ 12 | +| DS3231Clock | 17596/ 4992 | 7520/ 832 | +| DS3231Clock | 22508/ 4180 | 12432/ 20 | |----------------------------------------+--------------+--------------| -| SystemClockLoop | 10976/ 4212 | 776/ 52 | -| SystemClockLoop+1 Basic zone | 22440/ 4212 | 12240/ 52 | -| SystemClockLoop+1 Extended zone | 25684/ 4212 | 15484/ 52 | +| SystemClockLoop | 10852/ 4212 | 776/ 52 | +| SystemClockLoop+1 Basic zone | 23860/ 4212 | 13784/ 52 | +| SystemClockLoop+1 Extended zone | 27104/ 4212 | 17028/ 52 | |----------------------------------------+--------------+--------------| -| SystemClockCoroutine | 11740/ 4244 | 1540/ 84 | -| SystemClockCoroutine+1 Basic zone | 23164/ 4244 | 12964/ 84 | -| SystemClockCoroutine+1 Extended zone | 26472/ 4244 | 16272/ 84 | +| SystemClockCoroutine | 11616/ 4244 | 1540/ 84 | +| SystemClockCoroutine+1 Basic zone | 24648/ 4244 | 14572/ 84 | +| SystemClockCoroutine+1 Extended zone | 27892/ 4244 | 17816/ 84 | +----------------------------------------------------------------------+ ``` diff --git a/examples/MemoryBenchmark/esp32.txt b/examples/MemoryBenchmark/esp32.txt index 759aa1e..8ad389a 100644 --- a/examples/MemoryBenchmark/esp32.txt +++ b/examples/MemoryBenchmark/esp32.txt @@ -1,14 +1,14 @@ -0 204513 1310720 16060 327680 -1 243921 1310720 17284 327680 -2 220449 1310720 16588 327680 +0 211077 1310720 16056 327680 +1 254241 1310720 16712 327680 +2 236477 1310720 16384 327680 3 -1 -1 -1 -1 -4 622433 1310720 37708 327680 -5 635397 1310720 37592 327680 +4 662693 1310720 37816 327680 +5 675649 1310720 37684 327680 6 -1 -1 -1 -1 7 -1 -1 -1 -1 -8 216297 1310720 16452 327680 -9 221601 1310720 16452 327680 -10 223981 1310720 16452 327680 -11 216929 1310720 16484 327680 -12 222229 1310720 16484 327680 -13 224593 1310720 16484 327680 +8 226601 1310720 16368 327680 +9 232041 1310720 16384 327680 +10 234405 1310720 16384 327680 +11 227213 1310720 16400 327680 +12 232649 1310720 16416 327680 +13 235017 1310720 16416 327680 diff --git a/examples/MemoryBenchmark/esp8266.txt b/examples/MemoryBenchmark/esp8266.txt index da0dbe1..655c3a0 100644 --- a/examples/MemoryBenchmark/esp8266.txt +++ b/examples/MemoryBenchmark/esp8266.txt @@ -1,14 +1,14 @@ 0 260109 1044464 27896 81920 -1 269505 1044464 28556 81920 -2 267297 1044464 28172 81920 +1 269573 1044464 28560 81920 +2 267365 1044464 28176 81920 3 -1 -1 -1 -1 -4 269101 1044464 28212 81920 -5 266601 1044464 28236 81920 +4 269137 1044464 28216 81920 +5 266637 1044464 28240 81920 6 -1 -1 -1 -1 7 -1 -1 -1 -1 8 264809 1044464 28124 81920 -9 271329 1044464 28684 81920 -10 273873 1044464 28828 81920 +9 271365 1044464 28688 81920 +10 273957 1044464 28832 81920 11 265353 1044464 28156 81920 -12 271889 1044464 28716 81920 -13 274433 1044464 28860 81920 +12 271925 1044464 28720 81920 +13 274517 1044464 28864 81920 diff --git a/examples/MemoryBenchmark/generate_readme.py b/examples/MemoryBenchmark/generate_readme.py index 0bb4018..9173a99 100755 --- a/examples/MemoryBenchmark/generate_readme.py +++ b/examples/MemoryBenchmark/generate_readme.py @@ -27,7 +27,7 @@ the baseline, and its memory usage numbers are subtracted from the subsequent `FEATURE_*` memory usage. -**Version**: AceTimeClock v1.1.0 +**Version**: AceTimeClock v1.2.2 **DO NOT EDIT**: This file was auto-generated using `make README.md`. @@ -105,11 +105,28 @@ * Using `` through `StmRtcClock` consumes an extra ~4kB of flash compared to using `Stm32F1Clock`. +**v1.2.2** + +* Upgrade tool chains + * Arduino CLI from 0.27.1 + * STM32duino from 2.3.0 + * AVR Core from 1.8.4 to 1.8.5 + * ESP32 Core from 2.0.2 to 2.0.5 + * Teensyduino from 1.56 to 1.57 +* Upgrade to AceTime v2.0 + * Update `NtpClock` to use AceTime `Epoch::currentEpochYear()` +* Many `Clock` classes increase in flash size + * AVR: 100-400 bytes + * ESP8266: 50-150 bytes + * Most likely due to the adjustable AceTime epoch + (`Epoch::currentEpochYear()`), and the change from `int8_t` year to + `int16_t` year. + ## Arduino Nano * 16MHz ATmega328P -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 -* Arduino AVR Boards 1.8.4 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 +* Arduino AVR Boards 1.8.5 ``` {nano_results} @@ -118,7 +135,7 @@ ## Sparkfun Pro Micro * 16 MHz ATmega32U4 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 * SparkFun AVR Boards 1.1.13 ``` @@ -128,8 +145,8 @@ ## STM32 Blue Pill * STM32F103C8, 72 MHz ARM Cortex-M3 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 -* STM32duino 2.2.0 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 +* STM32duino 2.3.0 ``` {stm32_results} @@ -138,7 +155,7 @@ ## ESP8266 * NodeMCU 1.0, 80MHz ESP8266 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 * ESP8266 Boards 3.0.2 ``` @@ -148,8 +165,8 @@ ## ESP32 * ESP32-01 Dev Board, 240 MHz Tensilica LX6 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 -* ESP32 Boards 2.0.2 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 +* ESP32 Boards 2.0.5 ``` {esp32_results} @@ -162,8 +179,8 @@ ## Teensy 3.2 * 96 MHz ARM Cortex-M4 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 -* Teensyduino 1.56 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 +* Teensyduino 1.57 ``` {teensy32_results} diff --git a/examples/MemoryBenchmark/micro.txt b/examples/MemoryBenchmark/micro.txt index 0e35274..529fcc3 100644 --- a/examples/MemoryBenchmark/micro.txt +++ b/examples/MemoryBenchmark/micro.txt @@ -1,14 +1,14 @@ 0 3490 28672 157 2560 -1 7818 28672 405 2560 -2 6358 28672 195 2560 -3 5560 28672 189 2560 +1 7948 28672 405 2560 +2 6488 28672 195 2560 +3 5704 28672 189 2560 4 -1 -1 -1 -1 5 -1 -1 -1 -1 6 -1 -1 -1 -1 7 -1 -1 -1 -1 8 3972 28672 212 2560 -9 9830 28672 400 2560 -10 13272 28672 434 2560 +9 10056 28672 400 2560 +10 13656 28672 434 2560 11 4776 28672 240 2560 -12 10604 28672 428 2560 -13 14046 28672 462 2560 +12 10830 28672 428 2560 +13 14430 28672 462 2560 diff --git a/examples/MemoryBenchmark/nano.txt b/examples/MemoryBenchmark/nano.txt index febc3fb..8f7d870 100644 --- a/examples/MemoryBenchmark/nano.txt +++ b/examples/MemoryBenchmark/nano.txt @@ -1,14 +1,14 @@ 0 496 30720 17 2048 -1 4828 30720 259 2048 -2 3282 30720 49 2048 -3 2598 30720 43 2048 +1 4958 30720 259 2048 +2 3412 30720 49 2048 +3 2742 30720 43 2048 4 -1 -1 -1 -1 5 -1 -1 -1 -1 6 -1 -1 -1 -1 7 -1 -1 -1 -1 8 1016 30720 72 2048 -9 6876 30720 262 2048 -10 10318 30720 296 2048 +9 7102 30720 262 2048 +10 10702 30720 296 2048 11 1820 30720 100 2048 -12 7650 30720 290 2048 -13 11092 30720 324 2048 +12 7876 30720 290 2048 +13 11476 30720 324 2048 diff --git a/examples/MemoryBenchmark/stm32.txt b/examples/MemoryBenchmark/stm32.txt index 862c7bd..39194df 100644 --- a/examples/MemoryBenchmark/stm32.txt +++ b/examples/MemoryBenchmark/stm32.txt @@ -1,14 +1,14 @@ -0 21892 131072 3544 20480 -1 30412 131072 3792 20480 -2 25956 131072 3612 20480 +0 21348 131072 3560 20480 +1 31940 131072 3836 20480 +2 25348 131072 3632 20480 3 -1 -1 -1 -1 4 -1 -1 -1 -1 5 -1 -1 -1 -1 -6 26456 131072 3616 20480 -7 22476 131072 3580 20480 -8 22332 131072 3628 20480 -9 26596 131072 3628 20480 -10 28580 131072 3628 20480 -11 22808 131072 3660 20480 -12 27068 131072 3660 20480 -13 29052 131072 3660 20480 +6 25840 131072 3640 20480 +7 21936 131072 3596 20480 +8 21792 131072 3644 20480 +9 26216 131072 3648 20480 +10 28256 131072 3648 20480 +11 22268 131072 3676 20480 +12 26688 131072 3680 20480 +13 28732 131072 3680 20480 diff --git a/examples/MemoryBenchmark/teensy32.txt b/examples/MemoryBenchmark/teensy32.txt index 3254b39..40bdd1a 100644 --- a/examples/MemoryBenchmark/teensy32.txt +++ b/examples/MemoryBenchmark/teensy32.txt @@ -1,14 +1,14 @@ -0 10200 262144 4160 65536 -1 17456 262144 4992 65536 -2 19192 262144 4172 65536 +0 10076 262144 4160 65536 +1 17596 262144 4992 65536 +2 22508 262144 4180 65536 3 -1 -1 -1 -1 4 -1 -1 -1 -1 5 -1 -1 -1 -1 6 -1 -1 -1 -1 7 -1 -1 -1 -1 -8 10976 262144 4212 65536 -9 22440 262144 4212 65536 -10 25684 262144 4212 65536 -11 11740 262144 4244 65536 -12 23164 262144 4244 65536 -13 26472 262144 4244 65536 +8 10852 262144 4212 65536 +9 23860 262144 4212 65536 +10 27104 262144 4212 65536 +11 11616 262144 4244 65536 +12 24648 262144 4244 65536 +13 27892 262144 4244 65536 From 9c6a9b9f84419738a41aca159720fa77045f7fa9 Mon Sep 17 00:00:00 2001 From: Brian Park Date: Tue, 8 Nov 2022 11:25:22 -0800 Subject: [PATCH 10/13] AutoBenchmark: Regenerate for v1.2.2 --- examples/AutoBenchmark/README.md | 38 +++++++++++++++-------- examples/AutoBenchmark/esp32.txt | 2 +- examples/AutoBenchmark/generate_readme.py | 32 +++++++++++++------ examples/AutoBenchmark/stm32.txt | 4 +-- 4 files changed, 50 insertions(+), 26 deletions(-) diff --git a/examples/AutoBenchmark/README.md b/examples/AutoBenchmark/README.md index 10914c5..98746d4 100644 --- a/examples/AutoBenchmark/README.md +++ b/examples/AutoBenchmark/README.md @@ -2,7 +2,7 @@ Here are the results from `AutoBenchmark.ino` for various boards. -**Version**: AceTimeClock v1.1.0 +**Version**: AceTimeClock v1.2.2 **DO NOT EDIT**: This file was auto-generated using `make README.md`. @@ -75,10 +75,22 @@ The CPU times below are given in microseconds. * The results for ESP8266 is surprisingly slow, slower than the AVR. Not sure why. +**v1.2.2** + +* Upgrade tool chains + * Arduino CLI from 0.27.1 + * STM32duino from 2.3.0 + * AVR Core from 1.8.4 to 1.8.5 + * ESP32 Core from 2.0.2 to 2.0.5 + * Teensyduino from 1.56 to 1.57 +* Upgrade to AceTime v2.0 + * Update `NtpClock` to use AceTime `Epoch::currentEpochYear()` +* No significant changes to CPU time. + ## Arduino Nano * 16MHz ATmega328P -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 * Arduino AVR Boards 1.8.4 ``` @@ -102,7 +114,7 @@ CPU: ## Sparkfun Pro Micro * 16 MHz ATmega32U4 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 * SparkFun AVR Boards 1.1.13 ``` @@ -126,8 +138,8 @@ CPU: ## STM32 Blue Pill * STM32F103C8, 72 MHz ARM Cortex-M3 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 -* STM32duino 2.2.0 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 +* STM32duino 2.3.0 ``` Sizes of Objects: @@ -142,9 +154,9 @@ CPU: +------------------------------------+-------------+----------+ | Method | micros/iter | diff | |------------------------------------+-------------+----------| -| EmptyLoop | 0.224 | 0.000 | +| EmptyLoop | 0.226 | 0.000 | |------------------------------------+-------------+----------| -| SystemClockLoop | 2.194 | 1.970 | +| SystemClockLoop | 2.111 | 1.885 | +------------------------------------+-------------+----------+ ``` @@ -152,7 +164,7 @@ CPU: ## ESP8266 * NodeMCU 1.0 clone, 80MHz ESP8266 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 * ESP8266 Boards 3.0.2 ``` @@ -178,8 +190,8 @@ CPU: ## ESP32 * ESP32-01 Dev Board, 240 MHz Tensilica LX6 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 -* ESP32 Boards 2.0.2 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 +* ESP32 Boards 2.0.5 ``` Sizes of Objects: @@ -196,7 +208,7 @@ CPU: |------------------------------------+-------------+----------| | EmptyLoop | 0.050 | 0.000 | |------------------------------------+-------------+----------| -| SystemClockLoop | 2.100 | 2.050 | +| SystemClockLoop | 2.101 | 2.051 | +------------------------------------+-------------+----------+ ``` @@ -204,8 +216,8 @@ CPU: ## Teensy 3.2 * 96 MHz ARM Cortex-M4 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 -* Teensyduino 1.56 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 +* Teensyduino 1.57 * Compiler options: "Faster" ``` diff --git a/examples/AutoBenchmark/esp32.txt b/examples/AutoBenchmark/esp32.txt index c7facb9..8997084 100644 --- a/examples/AutoBenchmark/esp32.txt +++ b/examples/AutoBenchmark/esp32.txt @@ -7,5 +7,5 @@ sizeof(SystemClockLoop): 52 sizeof(SystemClockCoroutine): 80 BENCHMARKS EmptyLoop 0.050 -SystemClockLoop 2.100 +SystemClockLoop 2.101 END diff --git a/examples/AutoBenchmark/generate_readme.py b/examples/AutoBenchmark/generate_readme.py index f18399d..a318c0b 100755 --- a/examples/AutoBenchmark/generate_readme.py +++ b/examples/AutoBenchmark/generate_readme.py @@ -24,7 +24,7 @@ Here are the results from `AutoBenchmark.ino` for various boards. -**Version**: AceTimeClock v1.1.0 +**Version**: AceTimeClock v1.2.2 **DO NOT EDIT**: This file was auto-generated using `make README.md`. @@ -97,10 +97,22 @@ * The results for ESP8266 is surprisingly slow, slower than the AVR. Not sure why. +**v1.2.2** + +* Upgrade tool chains + * Arduino CLI from 0.27.1 + * STM32duino from 2.3.0 + * AVR Core from 1.8.4 to 1.8.5 + * ESP32 Core from 2.0.2 to 2.0.5 + * Teensyduino from 1.56 to 1.57 +* Upgrade to AceTime v2.0 + * Update `NtpClock` to use AceTime `Epoch::currentEpochYear()` +* No significant changes to CPU time. + ## Arduino Nano * 16MHz ATmega328P -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 * Arduino AVR Boards 1.8.4 ``` @@ -110,7 +122,7 @@ ## Sparkfun Pro Micro * 16 MHz ATmega32U4 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 * SparkFun AVR Boards 1.1.13 ``` @@ -120,8 +132,8 @@ ## STM32 Blue Pill * STM32F103C8, 72 MHz ARM Cortex-M3 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 -* STM32duino 2.2.0 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 +* STM32duino 2.3.0 ``` {stm32_results} @@ -130,7 +142,7 @@ ## ESP8266 * NodeMCU 1.0 clone, 80MHz ESP8266 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 * ESP8266 Boards 3.0.2 ``` @@ -140,8 +152,8 @@ ## ESP32 * ESP32-01 Dev Board, 240 MHz Tensilica LX6 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 -* ESP32 Boards 2.0.2 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 +* ESP32 Boards 2.0.5 ``` {esp32_results} @@ -150,8 +162,8 @@ ## Teensy 3.2 * 96 MHz ARM Cortex-M4 -* Arduino IDE 1.8.19, Arduino CLI 0.20.2 -* Teensyduino 1.56 +* Arduino IDE 1.8.19, Arduino CLI 0.27.1 +* Teensyduino 1.57 * Compiler options: "Faster" ``` diff --git a/examples/AutoBenchmark/stm32.txt b/examples/AutoBenchmark/stm32.txt index 80d7c0f..5b38dec 100644 --- a/examples/AutoBenchmark/stm32.txt +++ b/examples/AutoBenchmark/stm32.txt @@ -6,6 +6,6 @@ sizeof(SystemClock): 36 sizeof(SystemClockLoop): 52 sizeof(SystemClockCoroutine): 80 BENCHMARKS -EmptyLoop 0.224 -SystemClockLoop 2.194 +EmptyLoop 0.226 +SystemClockLoop 2.111 END From d17d1ab9af42fac46ad2b21fc8794c7b6535d813 Mon Sep 17 00:00:00 2001 From: Brian Park Date: Tue, 8 Nov 2022 11:25:40 -0800 Subject: [PATCH 11/13] README.md: Update tool chain version numbers --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8886c60..2278dac 100644 --- a/README.md +++ b/README.md @@ -1709,16 +1709,16 @@ compiler errors: This library was developed and tested using: * [Arduino IDE 1.8.19](https://www.arduino.cc/en/Main/Software) -* [Arduino CLI 0.20.2](https://arduino.github.io/arduino-cli) +* [Arduino CLI 0.27.1](https://arduino.github.io/arduino-cli) * [SpenceKonde ATTinyCore 1.5.2](https://github.com/SpenceKonde/ATTinyCore) -* [Arduino AVR Boards 1.8.4](https://github.com/arduino/ArduinoCore-avr) +* [Arduino AVR Boards 1.8.5](https://github.com/arduino/ArduinoCore-avr) * [Arduino SAMD Boards 1.8.9](https://github.com/arduino/ArduinoCore-samd) * [SparkFun AVR Boards 1.1.13](https://github.com/sparkfun/Arduino_Boards) -* [SparkFun SAMD Boards 1.8.4](https://github.com/sparkfun/Arduino_Boards) -* [STM32duino 2.2.0](https://github.com/stm32duino/Arduino_Core_STM32) +* [SparkFun SAMD Boards 1.8.6](https://github.com/sparkfun/Arduino_Boards) +* [STM32duino 2.3.0](https://github.com/stm32duino/Arduino_Core_STM32) * [ESP8266 Arduino 3.0.2](https://github.com/esp8266/Arduino) -* [ESP32 Arduino 2.0.2](https://github.com/espressif/arduino-esp32) -* [Teensyduino 1.56](https://www.pjrc.com/teensy/td_download.html) +* [ESP32 Arduino 2.0.5](https://github.com/espressif/arduino-esp32) +* [Teensyduino 1.57](https://www.pjrc.com/teensy/td_download.html) This library is *not* compatible with: From 3f802d3a857a10c146ddf862b9e0176872e8f13b Mon Sep 17 00:00:00 2001 From: Brian Park Date: Tue, 8 Nov 2022 11:26:17 -0800 Subject: [PATCH 12/13] docs: Regenerate doxygen --- docs/html/AceTimeClock_8h_source.html | 6 +- docs/html/ClockInterface_8h_source.html | 2 +- docs/html/Clock_8h_source.html | 2 +- docs/html/DS3231Clock_8h_source.html | 2 +- docs/html/DS3231_8h_source.html | 2 +- docs/html/EspSntpClock_8cpp_source.html | 2 +- docs/html/EspSntpClock_8h_source.html | 28 ++-- docs/html/HardwareDateTime_8cpp_source.html | 2 +- docs/html/HardwareDateTime_8h_source.html | 2 +- docs/html/HardwareTemperature_8h_source.html | 2 +- docs/html/NtpClock_8cpp_source.html | 150 +++++++++++------- docs/html/NtpClock_8h_source.html | 141 ++++++++-------- docs/html/Stm32F1Clock_8h_source.html | 84 +++++----- docs/html/Stm32F1Rtc_8cpp_source.html | 2 +- docs/html/Stm32F1Rtc_8h_source.html | 2 +- docs/html/StmRtcClock_8h_source.html | 108 ++++++------- docs/html/StmRtc_8cpp_source.html | 2 +- docs/html/StmRtc_8h_source.html | 2 +- docs/html/SystemClockCoroutine_8h_source.html | 2 +- docs/html/SystemClockLoop_8h_source.html | 2 +- docs/html/SystemClock_8h_source.html | 2 +- docs/html/UnixClock_8h_source.html | 26 +-- docs/html/annotated.html | 2 +- ...ssace__time_1_1clock_1_1Clock-members.html | 2 +- .../classace__time_1_1clock_1_1Clock.html | 2 +- ..._time_1_1clock_1_1DS3231Clock-members.html | 2 +- ...lassace__time_1_1clock_1_1DS3231Clock.html | 2 +- ...time_1_1clock_1_1EspSntpClock-members.html | 2 +- ...assace__time_1_1clock_1_1EspSntpClock.html | 7 +- ...ce__time_1_1clock_1_1NtpClock-members.html | 35 ++-- .../classace__time_1_1clock_1_1NtpClock.html | 55 ++++++- ...time_1_1clock_1_1Stm32F1Clock-members.html | 2 +- ...assace__time_1_1clock_1_1Stm32F1Clock.html | 11 +- ..._time_1_1clock_1_1StmRtcClock-members.html | 2 +- ...lassace__time_1_1clock_1_1StmRtcClock.html | 14 +- ...ck_1_1SystemClockLoopTemplate-members.html | 2 +- ...e_1_1clock_1_1SystemClockLoopTemplate.html | 2 +- ...1clock_1_1SystemClockTemplate-members.html | 2 +- ..._time_1_1clock_1_1SystemClockTemplate.html | 2 +- ...e__time_1_1clock_1_1UnixClock-members.html | 2 +- .../classace__time_1_1clock_1_1UnixClock.html | 7 +- ..._time_1_1hw_1_1ClockInterface-members.html | 2 +- ...lassace__time_1_1hw_1_1ClockInterface.html | 2 +- ...lassace__time_1_1hw_1_1DS3231-members.html | 2 +- docs/html/classace__time_1_1hw_1_1DS3231.html | 2 +- ...lassace__time_1_1hw_1_1StmRtc-members.html | 2 +- docs/html/classace__time_1_1hw_1_1StmRtc.html | 2 +- docs/html/classes.html | 2 +- .../dir_173dd563440c1e02d7e3957b90659cd7.html | 2 +- .../dir_1a3db1509c5a81eeb8e8fbfe5ac0febc.html | 2 +- .../dir_68267d1309a1af8e8297ef4c3efbcdba.html | 2 +- .../dir_710a5327734d15938c9752b39a7d94e5.html | 2 +- docs/html/files.html | 2 +- docs/html/functions.html | 5 +- docs/html/functions_func.html | 5 +- docs/html/functions_vars.html | 2 +- docs/html/graph_legend.html | 2 +- docs/html/hierarchy.html | 2 +- docs/html/index.html | 2 +- docs/html/inherits.html | 2 +- docs/html/search/all_10.js | 2 +- docs/html/search/all_11.js | 2 +- docs/html/search/all_12.js | 2 +- docs/html/search/all_13.js | 2 +- docs/html/search/all_2.js | 3 +- docs/html/search/all_3.js | 8 +- docs/html/search/all_4.js | 2 +- docs/html/search/all_5.js | 2 +- docs/html/search/all_6.js | 16 +- docs/html/search/all_7.js | 6 +- docs/html/search/all_8.js | 10 +- docs/html/search/all_9.js | 28 ++-- docs/html/search/all_a.js | 4 +- docs/html/search/all_b.js | 8 +- docs/html/search/all_c.js | 2 +- docs/html/search/all_d.js | 2 +- docs/html/search/all_e.js | 6 +- docs/html/search/all_f.js | 30 ++-- docs/html/search/classes_0.js | 4 +- docs/html/search/classes_1.js | 4 +- docs/html/search/classes_2.js | 2 +- docs/html/search/classes_3.js | 4 +- docs/html/search/classes_4.js | 2 +- docs/html/search/classes_5.js | 12 +- docs/html/search/classes_6.js | 2 +- docs/html/search/functions_0.js | 2 +- docs/html/search/functions_1.js | 5 +- docs/html/search/functions_2.js | 4 +- docs/html/search/functions_3.js | 2 +- docs/html/search/functions_4.js | 16 +- docs/html/search/functions_5.js | 10 +- docs/html/search/functions_6.js | 2 +- docs/html/search/functions_7.js | 2 +- docs/html/search/functions_8.js | 2 +- docs/html/search/functions_9.js | 2 +- docs/html/search/functions_a.js | 2 +- docs/html/search/functions_b.js | 6 +- docs/html/search/functions_c.js | 24 +-- docs/html/search/functions_d.js | 2 +- docs/html/search/functions_e.js | 2 +- docs/html/search/pages_0.js | 2 +- docs/html/search/variables_0.js | 4 +- docs/html/search/variables_1.js | 2 +- docs/html/search/variables_2.js | 26 +-- docs/html/search/variables_3.js | 2 +- docs/html/search/variables_4.js | 6 +- docs/html/search/variables_5.js | 2 +- docs/html/search/variables_6.js | 2 +- ...ime_1_1hw_1_1HardwareDateTime-members.html | 2 +- ...ctace__time_1_1hw_1_1HardwareDateTime.html | 2 +- ..._1_1hw_1_1HardwareTemperature-members.html | 2 +- ...ce__time_1_1hw_1_1HardwareTemperature.html | 2 +- 112 files changed, 588 insertions(+), 486 deletions(-) diff --git a/docs/html/AceTimeClock_8h_source.html b/docs/html/AceTimeClock_8h_source.html index e61a8d6..a24a5f0 100644 --- a/docs/html/AceTimeClock_8h_source.html +++ b/docs/html/AceTimeClock_8h_source.html @@ -22,7 +22,7 @@
AceTimeClock -  1.2.1 +  1.2.2
Clock classes for Arduino that can synchronize from an NTP server or an RTC chip
@@ -99,8 +99,8 @@
37 #endif // #if defined(ARDUINO_ARCH_STM32) || defined(EPOXY_DUINO)
38 
39 // Version format: xxyyzz == "xx.yy.zz"
-
40 #define ACE_TIME_CLOCK_VERSION 10201
-
41 #define ACE_TIME_CLOCK_VERSION_STRING "1.2.1"
+
40 #define ACE_TIME_CLOCK_VERSION 10202
+
41 #define ACE_TIME_CLOCK_VERSION_STRING "1.2.2"
42 
43 #endif
diff --git a/docs/html/ClockInterface_8h_source.html b/docs/html/ClockInterface_8h_source.html index 01fd7d7..dd4fa70 100644 --- a/docs/html/ClockInterface_8h_source.html +++ b/docs/html/ClockInterface_8h_source.html @@ -22,7 +22,7 @@
AceTimeClock -  1.2.1 +  1.2.2
Clock classes for Arduino that can synchronize from an NTP server or an RTC chip
diff --git a/docs/html/Clock_8h_source.html b/docs/html/Clock_8h_source.html index 46e6fc6..36c4636 100644 --- a/docs/html/Clock_8h_source.html +++ b/docs/html/Clock_8h_source.html @@ -22,7 +22,7 @@
AceTimeClock -  1.2.1 +  1.2.2
Clock classes for Arduino that can synchronize from an NTP server or an RTC chip
diff --git a/docs/html/DS3231Clock_8h_source.html b/docs/html/DS3231Clock_8h_source.html index 218439f..56a1d94 100644 --- a/docs/html/DS3231Clock_8h_source.html +++ b/docs/html/DS3231Clock_8h_source.html @@ -22,7 +22,7 @@
AceTimeClock -  1.2.1 +  1.2.2
Clock classes for Arduino that can synchronize from an NTP server or an RTC chip
diff --git a/docs/html/DS3231_8h_source.html b/docs/html/DS3231_8h_source.html index 8728c21..15dccec 100644 --- a/docs/html/DS3231_8h_source.html +++ b/docs/html/DS3231_8h_source.html @@ -22,7 +22,7 @@
AceTimeClock -  1.2.1 +  1.2.2
Clock classes for Arduino that can synchronize from an NTP server or an RTC chip
diff --git a/docs/html/EspSntpClock_8cpp_source.html b/docs/html/EspSntpClock_8cpp_source.html index 6a23256..3165cc2 100644 --- a/docs/html/EspSntpClock_8cpp_source.html +++ b/docs/html/EspSntpClock_8cpp_source.html @@ -22,7 +22,7 @@
AceTimeClock -  1.2.1 +  1.2.2
Clock classes for Arduino that can synchronize from an NTP server or an RTC chip
diff --git a/docs/html/EspSntpClock_8h_source.html b/docs/html/EspSntpClock_8h_source.html index 6e790e6..6442361 100644 --- a/docs/html/EspSntpClock_8h_source.html +++ b/docs/html/EspSntpClock_8h_source.html @@ -22,7 +22,7 @@
AceTimeClock -  1.2.1 +  1.2.2
Clock classes for Arduino that can synchronize from an NTP server or an RTC chip
@@ -100,24 +100,24 @@
47  const char* ntpServer = kDefaultNtpServer,
48  uint32_t timeoutMillis = kDefaultTimeoutMillis);
49 
-
50  acetime_t getNow() const override {
-
51  return time(nullptr)
-
52  - Epoch::secondsToCurrentEpochFromUnixEpoch64();
-
53  }
-
54 };
-
55 
-
56 }
-
57 }
-
58 
-
59 #endif
-
60 
-
61 #endif
+
58  acetime_t getNow() const override {
+
59  return time(nullptr)
+
60  - Epoch::secondsToCurrentEpochFromUnixEpoch64();
+
61  }
+
62 };
+
63 
+
64 }
+
65 }
+
66 
+
67 #endif
+
68 
+
69 #endif
Abstract base class for objects that provide and store time.
Definition: Clock.h:19
An implementation of Clock that configures the built-in SNTP client on the ESP8266 and ESP32 using th...
Definition: EspSntpClock.h:25
static const uint32_t kDefaultTimeoutMillis
Default time out for setup().
Definition: EspSntpClock.h:31
bool setup(const char *ntpServer=kDefaultNtpServer, uint32_t timeoutMillis=kDefaultTimeoutMillis)
Setup the SNTP client.
static const char kDefaultNtpServer[]
Default NTP server, "pool.ntp.org".
Definition: EspSntpClock.h:28
-
acetime_t getNow() const override
Return the number of seconds since the AceTime epoch (2000-01-01T00:00:00Z).
Definition: EspSntpClock.h:50
+
acetime_t getNow() const override
Return the number of seconds since the AceTime epoch (2000-01-01T00:00:00Z).
Definition: EspSntpClock.h:58