AceTime  3.0.0
Date and time classes for Arduino that support timezones from the TZ Database.
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ace_time::ZonedExtra Class Reference

Public Member Functions

 ZonedExtra ()
 Consructor.
 
 ZonedExtra (uint8_t type, int32_t stdOffsetSeconds, int32_t dstOffsetSeconds, int32_t reqStdOffsetSeconds, int32_t reqDstOffsetSeconds, const char *abbrev)
 Consructor.
 
bool isError () const
 Indicates that the LocalDateTime or epochSeconds was not found.
 
uint8_t type () const
 
TimeOffset stdOffset () const
 STD offset of the resulting OffsetDateTime.
 
TimeOffset dstOffset () const
 DST offset of the resulting OffsetDateTime.
 
TimeOffset timeOffset () const
 The total time offset (stdOffset + dstOffset). More...
 
TimeOffset reqStdOffset () const
 STD offset of the requested epochSeconds or LocalDateTime. More...
 
TimeOffset reqDstOffset () const
 DST offset of the requested epochSeconds or LocalDateTime. More...
 
TimeOffset reqTimeOffset () const
 The total time offset of the requested epochSeconds of LocalDateTime, (reqStdOffset + reqDstOffset). More...
 
const char * abbrev () const
 Returns the pointer to the local string buffer containing the timezone abbreviation (e.g. More...
 

Static Public Member Functions

static ZonedExtra forError ()
 Return an instance that indicates an error.
 
static ZonedExtra forComponents (int16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, const TimeZone &tz, uint8_t fold=0)
 Return an instance for the given LocalDateTime and TimeZone. More...
 
static ZonedExtra forEpochSeconds (acetime_t epochSeconds, const TimeZone &tz)
 Return an instance for the given epochSeconds and TimeZone.
 
static ZonedExtra forLocalDateTime (const LocalDateTime &ldt, const TimeZone &tz)
 Return an instance for the given LocalDateTime and TimeZone. More...
 

Static Public Attributes

static const uint8_t kAbbrevSize = ace_time::kAbbrevSize
 Size of char buffer needed to hold the largest abbreviation.
 
static const uint8_t kTypeNotFound = 0
 The epochSeconds or LocalDateTime was not found because it was outside the range of the zoneinfo database (too far past, or too far in the future).
 
static const uint8_t kTypeExact = 1
 The given LocalDateTime matches a single epochSeconds. More...
 
static const uint8_t kTypeGap = 2
 The given LocalDateTime occurs in a gap and does not match any epochSeconds. More...
 
static const uint8_t kTypeOverlap = 3
 The given LocalDateTime matches 2 possible epochSeconds, which is disambguiated by the LocalDateTime::fold input parameter. More...
 

Detailed Description

Definition at line 19 of file ZonedExtra.h.

Member Function Documentation

◆ abbrev()

const char* ace_time::ZonedExtra::abbrev ( ) const
inline

Returns the pointer to the local string buffer containing the timezone abbreviation (e.g.

"PST", "PDT") used at the given LocalDateTime or epochSeconds. This pointer is safe to use as long as this object is alive.

Definition at line 166 of file ZonedExtra.h.

◆ forComponents()

ZonedExtra ace_time::ZonedExtra::forComponents ( int16_t  year,
uint8_t  month,
uint8_t  day,
uint8_t  hour,
uint8_t  minute,
uint8_t  second,
const TimeZone tz,
uint8_t  fold = 0 
)
static

Return an instance for the given LocalDateTime and TimeZone.

If you already have a ZonedDateTime, then the LocalDateTime can be retrieved using ZonedDateTime::localDateTime().

Definition at line 6 of file ZonedExtra.cpp.

◆ forLocalDateTime()

ZonedExtra ace_time::ZonedExtra::forLocalDateTime ( const LocalDateTime ldt,
const TimeZone tz 
)
static

Return an instance for the given LocalDateTime and TimeZone.

If you already have a ZonedDateTime, then the LocalDateTime can be retrieved using ZonedDateTime::localDateTime().

Definition at line 23 of file ZonedExtra.cpp.

◆ reqDstOffset()

TimeOffset ace_time::ZonedExtra::reqDstOffset ( ) const
inline

DST offset of the requested epochSeconds or LocalDateTime.

This will be different from stdOffset only for kTypeGap.

Definition at line 143 of file ZonedExtra.h.

◆ reqStdOffset()

TimeOffset ace_time::ZonedExtra::reqStdOffset ( ) const
inline

STD offset of the requested epochSeconds or LocalDateTime.

This will be different from stdOffset only for kTypeGap.

Definition at line 135 of file ZonedExtra.h.

◆ reqTimeOffset()

TimeOffset ace_time::ZonedExtra::reqTimeOffset ( ) const
inline

The total time offset of the requested epochSeconds of LocalDateTime, (reqStdOffset + reqDstOffset).

This value becomes lost when a ZonedDateTime is created using ZonedDateTime::forComponents() during a DST gap, because it was used to convert the given LocalDateTime to an epochSeconds, before the epochSeconds was renormalized back into a ZonedDateTime. The ZonedExtra object provided access to this UTC offset.

Definition at line 155 of file ZonedExtra.h.

◆ timeOffset()

TimeOffset ace_time::ZonedExtra::timeOffset ( ) const
inline

The total time offset (stdOffset + dstOffset).

This will be the same value as ZonedDateTime::timeOffset() when a ZonedDataTime is created using ZonedDateTime::forComponents() or ZonedDateTime::forEpochSeconds().

Definition at line 127 of file ZonedExtra.h.

Member Data Documentation

◆ kTypeExact

const uint8_t ace_time::ZonedExtra::kTypeExact = 1
static

The given LocalDateTime matches a single epochSeconds.

The given epochSeconds matches a single LocalDateTime.

Definition at line 35 of file ZonedExtra.h.

◆ kTypeGap

const uint8_t ace_time::ZonedExtra::kTypeGap = 2
static

The given LocalDateTime occurs in a gap and does not match any epochSeconds.

A given epochSeconds will never return this because it will always match either a single LocalDateTime or match nothing.

Definition at line 43 of file ZonedExtra.h.

◆ kTypeOverlap

const uint8_t ace_time::ZonedExtra::kTypeOverlap = 3
static

The given LocalDateTime matches 2 possible epochSeconds, which is disambguiated by the LocalDateTime::fold input parameter.

The given epochSeconds matches a LocalDateTime that can occur twice, and is disambiguated by the OffsetDateTime::fold (same as ZonedDateTime::fold) output parameter.

Definition at line 52 of file ZonedExtra.h.


The documentation for this class was generated from the following files: