AceTime  2.2.0
Date and time classes for Arduino that support timezones from the TZ Database.
Functions
BrokerCommon.h File Reference

Helper functions are used in both Basic brokers and Extended brokers. More...

#include <stdint.h>
Include dependency graph for BrokerCommon.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int16_t ace_time::internal::toDeltaMinutes (uint8_t deltaCode)
 Convert the deltaCode in the ZoneInfo or the ZoneRule struct to the actual deltaMinutes. More...
 
int16_t ace_time::internal::toOffsetMinutes (int8_t offsetCode, uint8_t deltaCode)
 Convert the offsetCode and deltaCode into a signed 16-bit integer that represents the UTCOFF of the ZoneEra in minutes. More...
 
uint16_t ace_time::internal::timeCodeToMinutes (uint8_t code, uint8_t modifier)
 Convert (code, modifier) fields representing the UNTIL time in ZoneInfo or AT time in ZoneRule in one minute resolution. More...
 
uint8_t ace_time::internal::toSuffix (uint8_t modifier)
 Extract the 'w', 's' 'u' suffix from the 'modifier' field, so that they can be compared against kSuffixW, kSuffixS and kSuffixU. More...
 
const char * ace_time::internal::findShortName (const char *name)
 Return a pointer to the short name of a full ZoneName. More...
 
const __FlashStringHelper * ace_time::internal::findShortName (const __FlashStringHelper *fname)
 Same as fineShortName(const char*) but for flash strings (const __FlashStringHelper*).
 

Detailed Description

Helper functions are used in both Basic brokers and Extended brokers.

Definition in file BrokerCommon.h.

Function Documentation

◆ findShortName()

const char * ace_time::internal::findShortName ( const char *  name)

Return a pointer to the short name of a full ZoneName.

The short name is the last component, which usually begins after the last separator '/'. If the string has been compressed to be compatible with ace_common::KString, then the last component begins just after the last keyword reference (i.e. a non-printable character < ASCII 32). If the fully qualified name has no '/' or a keyword reference, then the short name is the entire string. The last component of the full ZoneName is never compressed, so we do not need to decompress it using ace_common::KString.

For example:

  • "America/Los_Angeles" returns a pointer to "Los_Angeles",
  • "\x01Denver" returns a pointer to "Denver", and
  • "UTC" returns "UTC".

Definition at line 14 of file BrokerCommon.cpp.

◆ timeCodeToMinutes()

uint16_t ace_time::internal::timeCodeToMinutes ( uint8_t  code,
uint8_t  modifier 
)
inline

Convert (code, modifier) fields representing the UNTIL time in ZoneInfo or AT time in ZoneRule in one minute resolution.

The code parameter holds the AT or UNTIL time in minutes component in units of 15 minutes. The lower 4-bits of modifier holds the remainder minutes.

Definition at line 51 of file BrokerCommon.h.

◆ toDeltaMinutes()

int16_t ace_time::internal::toDeltaMinutes ( uint8_t  deltaCode)
inline

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

The lower 4-bits stores minutes in units of 15-minutes, shifted by 1h, so can represent the interval [-01:00 to 02:45].

deltaMinutes = deltaCode * 15m - 1h

Definition at line 30 of file BrokerCommon.h.

◆ toOffsetMinutes()

int16_t ace_time::internal::toOffsetMinutes ( int8_t  offsetCode,
uint8_t  deltaCode 
)
inline

Convert the offsetCode and deltaCode into a signed 16-bit integer that represents the UTCOFF of the ZoneEra in minutes.

The offsetCode is rounded towards -infinity in 15-minute multiples. The upper 4-bits of deltaCode holds the (unsigned) remainder in one-minute increments.

Definition at line 40 of file BrokerCommon.h.

◆ toSuffix()

uint8_t ace_time::internal::toSuffix ( uint8_t  modifier)
inline

Extract the 'w', 's' 'u' suffix from the 'modifier' field, so that they can be compared against kSuffixW, kSuffixS and kSuffixU.

Used for Zone.UNTIL and Rule.AT fields.

Definition at line 60 of file BrokerCommon.h.