#include <baltzo_zoneinfoutil.h>
This struct
provides a namespace for utility operations using a Zoneinfo
object.
◆ convertUtcToLocalTime()
Load, into the specified resultTime
, the local date-time value, in the specified timeZone
, corresponding to the specified utcTime
, and load, into the specified resultTransition
, an iterator referring to the first transition in timeZone
whose transition-time is before utcTime
. Return 0 on success, and baltzo::ErrorCode::k_OUT_OF_RANGE
if resultTime
would be outside of the legal range that a bdlt::DatetimeTz
can represent. The behavior is undefined unless isWellFormed(timeZone)
is true
.
◆ isWellFormed()
static bool baltzo::ZoneinfoUtil::isWellFormed |
( |
const Zoneinfo & |
timeZone | ) |
|
|
static |
Return true
if the specified timeZone
is a well-formed Zoneinfo object (which can be used by other methods on this utility), and false
otherwise. For a Zoneinfo to be considered well-formed all of the following must be true:
timeZone.numTransitions() > 0
- The first transition in
timeZone
is at the first representable bdlt::Datetime
value, "Jan 01, 0001 00 00.000" – i.e., bdlt::Datetime(1, 1, 1)
.
- There is no transition in the ordered sequence of transitions described by
timeZone
where the local clock time is adjusted (either forwards or backwards) introducing a period of invalid or ambiguous local times, where that range of invalid or ambiguous local times overlaps with a range of invalid or or ambiguous local times introduced by the subsequent transition (see component documentation for an illustration).
Note that this method has linear worst-case time complexity with respect to timeZone.numTransitions()
.
◆ loadRelevantTransitions()
Load, into the specified firstResultTransition
, an iterator referring to the transition describing the characteristics of local time in effect at the specified localTime
in the specified timeZone
; in instances where localTime
is not both a unique and valid local time in timeZone
, load, into the specified secondResultTransition
, an iterator referring to a subsequent transition describing the alternative characteristics of local time that could also apply to localTime
; finally load, into the specified resultValidity
, the validity of localTime
as being unique, ambiguous but valid, or invalid. If resultValidity
is e_VALID_UNIQUE
, then firstResultTransition
and secondResultTransition
will be loaded with the same transition, otherwise the returned transitions will be distinct with secondResultTransition
referring to the transition immediately after firstResultTransition
. The behavior is undefined unless isWellFormed(timeZone)
is true
, and firstResultTransition != secondResultTransition
.
The documentation for this struct was generated from the following file: