AceTime
0.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.
|
The classes provide a thin layer of indirection for accessing the zoneinfo files stored in the zonedb/ and zonedbx/ directories. More...
#include "../common/flash.h"
#include "ZoneInfo.h"
Go to the source code of this file.
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 or ACE_TIME_USE_PROGMEM are 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 the ACE_TIME_USE_PROGMEM and ACE_TIME_USE_PROGMEM are disabled, the compiler will optimize away this entire abstraction layer, so the resulting machine code is no bigger than (and in most cases, identifical 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 core broker classes live in the common:: namespace and are templatized so that they can be used for both basic::Zone* classes and the extended::Zone* classes. Specific template instantiations are created in the basic:: and extended:: namespaces so that they can be used by the BasicZoneProcessor and ExtendedZoneProcessor respectively.
Definition in file Brokers.h.