Describe rules for when daylight/summer time begins, and when standard time begins. More...

#include <Timezone.h>

Collaboration diagram for TZ::Rule:

Classes

struct  Time
 

Public Types

using Tag = DateTime::ZoneInfo::Tag
 

Public Member Functions

int offsetSecs () const
 
time_t operator() (unsigned year) const
 Convert the given time change rule to a time_t value for the given year. More...
 
 operator int () const
 Obtain a numeric value for comparison purposes. More...
 
bool operator== (const Rule &other) const
 
bool operator!= (const Rule &other) const
 

Public Attributes

Tag tag
 e.g. DST, UTC, etc. More...
 
week_t week: 4
 
dow_t dow: 4
 
month_t month: 8
 
Time time
 
int16_t offsetMins
 Offset from UTC. More...
 

Static Public Attributes

static const Rule UTC
 

Detailed Description

Describe rules for when daylight/summer time begins, and when standard time begins.

This rule structure is an exact analogue of the POSIX 'M'-style rules, which are the only ones in general use. The GLIBC manual page provides a good overview of these rules:

    https://sourceware.org/glibc/manual/2.39/html_node/TZ-Variable.html

Original versions of this library only allowed a single value for hours, for example:

    {"BST", Last, Sun, Mar, 1, 60}

However, some zones also require a minute value, such as Pacific/Chatham which changes at 03:45. We can use a fractional value (3.75) for this:

    {"+1245", First, Sun, Apr, 3.75, 765}

Western greenland has a negative hours value, America/Godthab:

{"-01", Last, Sun, Mar, -1, -60}

Note that at time of writing newlib (the embedded C library) does not support negative time values (via tzset) and produces incorrect results.

Member Typedef Documentation

◆ Tag

Member Function Documentation

◆ offsetSecs()

int TZ::Rule::offsetSecs ( ) const
inline

◆ operator int()

TZ::Rule::operator int ( ) const
inlineexplicit

Obtain a numeric value for comparison purposes.

◆ operator!=()

bool TZ::Rule::operator!= ( const Rule other) const
inline

◆ operator()()

time_t TZ::Rule::operator() ( unsigned  year) const

Convert the given time change rule to a time_t value for the given year.

Parameters
yearWhich year to work with
Return values
time_tTimestamp for the given time change

◆ operator==()

bool TZ::Rule::operator== ( const Rule other) const
inline

Member Data Documentation

◆ dow

dow_t TZ::Rule::dow

◆ month

month_t TZ::Rule::month

◆ offsetMins

int16_t TZ::Rule::offsetMins

Offset from UTC.

◆ tag

Tag TZ::Rule::tag

e.g. DST, UTC, etc.

◆ time

Time TZ::Rule::time

◆ UTC

const Rule TZ::Rule::UTC
static

◆ week

week_t TZ::Rule::week

The documentation for this struct was generated from the following file: