|
static int | addInterval (LocalDatetime *result, const LocalDatetime &originalTime, const bsls::TimeInterval &interval) |
|
static int | convertUtcToLocalTime (LocalDatetime *result, const char *targetTimeZoneId, const bdlt::Datetime &utcTime) |
|
static int | convertUtcToLocalTime (bdlt::DatetimeTz *result, const char *targetTimeZoneId, const bdlt::Datetime &utcTime) |
|
static int | convertLocalToLocalTime (LocalDatetime *result, const char *targetTimeZoneId, const LocalDatetime &srcTime) |
|
static int | convertLocalToLocalTime (LocalDatetime *result, const char *targetTimeZoneId, const bdlt::DatetimeTz &srcTime) |
|
static int | convertLocalToLocalTime (bdlt::DatetimeTz *result, const char *targetTimeZoneId, const LocalDatetime &srcTime) |
|
static int | convertLocalToLocalTime (bdlt::DatetimeTz *result, const char *targetTimeZoneId, const bdlt::DatetimeTz &srcTime) |
|
static int | convertLocalToLocalTime (LocalDatetime *result, const char *targetTimeZoneId, const bdlt::Datetime &srcTime, const char *srcTimeZoneId, DstPolicy::Enum dstPolicy=DstPolicy::e_UNSPECIFIED) |
|
static int | convertLocalToLocalTime (bdlt::DatetimeTz *result, const char *targetTimeZoneId, const bdlt::Datetime &srcTime, const char *srcTimeZoneId, DstPolicy::Enum dstPolicy=DstPolicy::e_UNSPECIFIED) |
|
static int | initLocalTime (bdlt::DatetimeTz *result, const bdlt::Datetime &localTime, const char *timeZoneId, DstPolicy::Enum dstPolicy=DstPolicy::e_UNSPECIFIED) |
|
static int | initLocalTime (LocalDatetime *result, const bdlt::Datetime &localTime, const char *timeZoneId, DstPolicy::Enum dstPolicy=DstPolicy::e_UNSPECIFIED) |
|
static int | initLocalTime (bdlt::DatetimeTz *result, LocalTimeValidity::Enum *resultValidity, const bdlt::Datetime &localTime, const char *timeZoneId, DstPolicy::Enum dstPolicy=DstPolicy::e_UNSPECIFIED) |
|
static int | initLocalTime (LocalDatetime *result, LocalTimeValidity::Enum *resultValidity, const bdlt::Datetime &localTime, const char *timeZoneId, DstPolicy::Enum dstPolicy=DstPolicy::e_UNSPECIFIED) |
|
static int | convertLocalToUtc (bdlt::Datetime *result, const bdlt::Datetime &localTime, const char *timeZoneId, DstPolicy::Enum dstPolicy=DstPolicy::e_UNSPECIFIED) |
|
static int | convertLocalToUtc (LocalDatetime *result, const bdlt::Datetime &localTime, const char *timeZoneId, DstPolicy::Enum dstPolicy=DstPolicy::e_UNSPECIFIED) |
|
static int | loadLocalTimePeriod (LocalTimePeriod *result, const LocalDatetime &localTime) |
|
static int | loadLocalTimePeriod (LocalTimePeriod *result, const bdlt::DatetimeTz &localTime, const char *timeZoneId) |
|
static int | loadLocalTimePeriodForUtc (LocalTimePeriod *result, const char *timeZoneId, const bdlt::Datetime &utcTime) |
|
static int | now (bdlt::DatetimeTz *result, const char *timeZoneId) |
|
static int | now (LocalDatetime *result, const char *timeZoneId) |
|
static int | validateLocalTime (bool *result, const bdlt::DatetimeTz &localTime, const char *timeZoneId) |
|
static int | validateLocalTime (bool *result, const LocalDatetime &localTime) |
|
This struct
provides a namespace for utility functions that convert time values to, from, and between, their corresponding local time representations in (possibly) different time zones.
These utility functions are:
- alias-safe
- exception-neutral (agnostic)
- thread-safe For terminology see bsldoc_glossary .
Load, into the specified result
, the local date-time value – including the local date, time, and resolved UTC offset – indicated by the specified localTime
in the time zone indicated by the specified timeZoneId
. Optionally specify resultValidity
in which to load the validity of localTime
as being unique, ambiguous but valid, or invalid. Optionally specify a dstPolicy
indicating whether or not localTime
represents a daylight-saving time value. If dstPolicy
is unspecified and localTime
is a unique and valid time in the source time zone, then perform the conversion using that uniquely described time; if dstPolicy
is unspecified and localTime
is either ambiguous or invalid, then use the later of the two possible interpretations of localTime
. The offset from UTC of the time zone is rounded down to minute precision. Return 0 on success, and a non-zero value with no effect otherwise. A return value of ErrorCode::k_UNSUPPORTED_ID
indicates that timeZoneId
was not recognized. The behavior is undefined unless the result of the initialization falls within the supported epoch.
static int baltzo::TimeZoneUtil::validateLocalTime |
( |
bool * |
result, |
|
|
const bdlt::DatetimeTz & |
localTime, |
|
|
const char * |
timeZoneId |
|
) |
| |
|
static |
Load, into the specified result
, true
if the offset from UTC of the specified localTime
(i.e., localTime.offset()
) is consistent with the actual local time offset, as indicated by time zone data, at the UTC time localTime.utcDatetime()
in the time zone indicated by the specified timeZoneId
, and false
otherwise. Return 0 on success, and a non-zero value with false
loaded into result
otherwise. A return value of ErrorCode::k_UNSUPPORTED_ID
indicates that timeZoneId
is not recognized. Note that this operation verifies that the properties of the provided local time are consistent with the time zone data.
int baltzo::TimeZoneUtil::validateLocalTime |
( |
bool * |
result, |
|
|
const LocalDatetime & |
localTime |
|
) |
| |
|
inlinestatic |
Load, into the specified result
, true
if the time zone identifier of the specified localTime
(i.e., localTime.timeZoneId()
) is a valid identifier, and the offset from UTC of localTime
(i.e., localTime.datetimeTz().offset()
) is consistent with the actual local time offset, as indicated by time zone data, at the UTC time localTime.datetimeTz().utcDatetime()
in the time zone indicated by localTime.timeZoneId()
, and false
otherwise. Return 0 on success, and a non-zero value with false
loaded into result
otherwise. A return value of ErrorCode::k_UNSUPPORTED_ID
indicates that timeZoneId
is not recognized. Note that this operation verifies that the properties of the provided local time are consistent with the time zone data.