AceTime 3.0.0 Date and time classes for Arduino that support timezones from the TZ Database.

Typedefs | Functions | Variables
common.h File Reference

Identifiers used by implementation code which need to be publically exported. More...

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

Go to the source code of this file.

## Typedefs
typedef int32_t | ace_time::acetime_t
| Type for the number of seconds from epoch. More...

## Functions
template<typename T >
void | ace_time::swap (T &a, T &b)
| Swap 2 parameters.

## Variables
const uint8_t | ace_time::kAbbrevSize = 7 + 1
| Size of the c-string buffer needed to hold a time zone abbreviation. More...

## Detailed Description

Identifiers used by implementation code which need to be publically exported.

Definition in file common.h.

## Typedef Documentation

## ◆ acetime_t

typedef int32_t ace_time::acetime_t

Type for the number of seconds from epoch.

The AceTime epoch is 2050-01-01 00:00:00 UTC by default but can be changed using `Epoch::currentEpochYear()`. Unix epoch is 1970-01-01 00:00:00 UTC.

Definition at line 24 of file common.h.

## Variable Documentation

## ◆ kAbbrevSize

const uint8_t ace_time::kAbbrevSize = 7 + 1

Size of the c-string buffer needed to hold a time zone abbreviation.

- The longest explicit abbreviation in the database (as of 2019 or so) seems to be 5 characters (https://www.timeanddate.com/time/zones/)
- The TZ database spec used to say that abbreviations are 3 to 6 characters but that wording is no longer in the document (https://data.iana.org/time-zones/theory.html#abbreviations).
- The zic(1) man page says "A time zone abbreviation has fewer than 3 or more than 6 characters. POSIX requires at least 3, and requires implementations to support at least 6". The first part of that wording makes no sense at all.
- The z specifier, added in TZDB 2024b, autogenerates the abbreviation using a [+/-][hh[mm[ss]]] pattern, which can be 7 characters long.

Let's increase the max length from 6 to 7 to handle the z. We also need one extra byte for the terminating NUL character.

Definition at line 44 of file common.h.