AceTime
1.7.5
Date and time classes for Arduino that support timezones from the TZ Database, and a system clock that can synchronize from an NTP server or an RTC chip.
|
#include <stdint.h>
#include "../common/compat.h"
#include "BrokerCommon.h"
#include "ZoneInfo.h"
#include "LinkEntry.h"
Go to the source code of this file.
Classes | |
class | ace_time::basic::ZoneRuleBroker |
Data broker for accessing ZoneRule. More... | |
class | ace_time::basic::ZonePolicyBroker |
Data broker for accessing ZonePolicy. More... | |
class | ace_time::basic::ZoneEraBroker |
Data broker for accessing ZoneEra. More... | |
class | ace_time::basic::ZoneInfoBroker |
Data broker for accessing ZoneInfo. More... | |
class | ace_time::basic::ZoneRegistryBroker |
Data broker for accessing the ZoneRegistry. More... | |
class | ace_time::basic::LinkEntryBroker |
Data broker for accessing a LinkEntry. More... | |
class | ace_time::basic::LinkRegistryBroker |
Data broker for a LinkRegistry composed of LinkEntry records. More... | |
class | ace_time::basic::BrokerFactory |
A factory that creates a basic::ZoneInfoBroker. More... | |
The classes provide a thin layer of indirection for accessing the zoneinfo files stored in the zonedb/ and zonedbx/ directories. When ACE_TIME_USE_PROGMEM is enabled, the zoneinfo files are stored in flash memory (using the PROGMEM keyword), and cannot be accessed directly on microcontrollers using the Harvard architecture (e.g. AVR) where data and program live in 2 different address spaces. The data in flash memory must be accessed using helper routines in <pgmspace.h>. These classes abstract away this difference so that the code BasicZoneProcessor and ExtendedZoneProcessor can be written to be (mostly) agnostic to how the zoneinfo files are stored.
When ACE_TIME_USE_PROGMEM is disabled, the compiler will optimize away this entire abstraction layer, so the resulting machine code is no bigger than (and in most cases, identical to) accessing the zoneinfo files directly.
The abstraction layer is thin enough that the code in BasicZoneProcessor and ExtendedZoneProcessor did not change very much. It was mostly a mechanical source code replacement of direct zoneinfo access to using these data brokers.
The classes are somewhat duplicated between the 'basic' and 'extended' namespaces. They used to be identical so that they could be templatized. But supporting one-minute resolution for 'extended' meant that the implementations diverged, so I had to manually duplicate the classes.
Definition in file BasicBrokers.h.