AceTime  1.9.0
Date and time classes for Arduino that support timezones from the TZ Database.
Classes | Functions
ExtendedBrokers.h File Reference
#include <stdint.h>
#include "../common/compat.h"
#include "BrokerCommon.h"
#include "ZoneInfo.h"
#include "LinkEntry.h"
Include dependency graph for ExtendedBrokers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ace_time::extended::ZoneRuleBroker
 Data broker for accessing ZoneRule. More...
 
class  ace_time::extended::ZonePolicyBroker
 Data broker for accessing ZonePolicy. More...
 
class  ace_time::extended::ZoneEraBroker
 Data broker for accessing ZoneEra. More...
 
class  ace_time::extended::ZoneInfoBroker
 Data broker for accessing ZoneInfo. More...
 
class  ace_time::extended::ZoneRegistryBroker
 Data broker for accessing the ZoneRegistry. More...
 
class  ace_time::extended::LinkEntryBroker
 Data broker for accessing a LinkEntry. More...
 
class  ace_time::extended::LinkRegistryBroker
 Data broker for a LinkRegistry composed of LinkEntry records. More...
 
class  ace_time::extended::BrokerFactory
 A factory that creates a basic::ZoneInfoBroker. More...
 

Functions

int16_t ace_time::extended::toDeltaMinutes (int8_t deltaCode)
 Convert the deltaCode in the ZoneInfo struct to the actual deltaMinutes. More...
 
int16_t ace_time::extended::toOffsetMinutes (int8_t offsetCode, int8_t deltaCode)
 Convert the offsetCode and deltaCode into a signed 8-bit integer. More...
 

Detailed Description

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 ExtendedBrokers.h.

Function Documentation

◆ toDeltaMinutes()

int16_t ace_time::extended::toDeltaMinutes ( int8_t  deltaCode)
inline

Convert the deltaCode in the ZoneInfo struct to the actual deltaMinutes.

The lower 4-bits can store -01:00 to 02:45.

deltaMinutes = deltaCode * 15m - 1h

Definition at line 57 of file ExtendedBrokers.h.

◆ toOffsetMinutes()

int16_t ace_time::extended::toOffsetMinutes ( int8_t  offsetCode,
int8_t  deltaCode 
)
inline

Convert the offsetCode and deltaCode into a signed 8-bit integer.

The offsetCode holds the upper 15-minute multiples. The upper 4-bits of deltaCode holds the one-minute resolution, as an unsigned offset.

Definition at line 66 of file ExtendedBrokers.h.