BDE 4.14.0 Production release
|
#include <baltzo_timezoneutil.h>
Static Public Member Functions | |
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:
|
static |
Load, into the specified result
, the local time value that is the specified interval
in the future of the specified originalTime
(in the time zone originalTime.timeZoneId()
). Return 0 on success, and a non-zero value with no effect otherwise. A return value of ErrorCode::k_UNSUPPORTED_ID
indicates that targetTimeZoneId
was not recognized, and a return value of ErrorCode::k_OUT_OF_RANGE
indicates that the result of the operation would have been outside the range of values representable by the result
type. The resulting local-time is equivalent to adding interval
to originalTime.datetimeTz().utcDatetime()
and converting the result into the local time of originalTime.timeZoneId()
.
|
static |
Load, into the specified result
, the local date-time value (in the time zone indicated by the specified targetTimeZoneId
) corresponding to the local time indicated by the specified srcTime
(in the time zone indicated by the specified srcTimeZoneId
). Optionally specify a dstPolicy
indicating whether or not srcTime
represents a daylight-saving time value. If dstPolicy
is unspecified and srcTime
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 srcTime
is either ambiguous or invalid, then use the later of the two possible interpretations of srcTime
. The offset from UTC of both time zones 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 either targetTimeZoneId
or srcTimeZoneId
was not recognized.
|
inlinestatic |
Load, into the specified result
, the local date-time value (in the time zone indicated by the specified targetTimeZoneId
) corresponding to the local time indicated by the specified srcTime
. The offset from UTC of both time zones 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 targetTimeZoneId
was not recognized, and a return value of ErrorCode::k_OUT_OF_RANGE
indicates that the result of the operation would have been outside the range of values representable by the result
type.
|
inlinestatic |
|
static |
|
inlinestatic |
|
inlinestatic |
|
static |
|
static |
Load, into the specified result
, the UTC time value that corresponds to the specified localTime
in the time zone indicated by the specified timeZoneId
. 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 conversion falls within the supported epoch.
|
inlinestatic |
Load, into the specified result
, the local date-time value (in the time zone indicated by the specified targetTimeZoneId
) corresponding to the specified utcTime
. 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 targetTimeZoneId
was not recognized, and a return value of ErrorCode::k_OUT_OF_RANGE
indicates that the result of the operation would have been outside the range of values representable by the result
type.
|
static |
|
inlinestatic |
|
inlinestatic |
|
static |
|
static |
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.
|
inlinestatic |
Load, into the specified result
, attributes characterizing the specified localTime
in the time zone indicated by the specified timeZoneId
(i.e., the offset from UTC, whether daylight-saving time is in effect and the description of the time zone), as well as the time interval over which those attributes apply. 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.
|
inlinestatic |
Load, into the specified result
, attributes characterizing the specified localTime
(i.e., the offset from UTC, whether daylight-saving time is in effect and the description of the time zone), as well as the time interval over which those attributes apply. Return 0 on success, and a non-zero value with no effect otherwise. A return value of ErrorCode::k_UNSUPPORTED_ID
indicates that localTime.timeZoneId()
was not recognized.
|
static |
Load, into the specified result
, attributes characterizing local time at the specified utcTime
in the time zone indicated by the specified timeZoneId
(i.e., the offset from UTC, whether daylight-saving time is in effect and the description of the time zone), as well as the time interval over which those attributes apply. 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.
|
inlinestatic |
|
inlinestatic |
Load, into the specified result
, the current local time value in the time zone indicated by the specified timeZoneId
. Return 0 on success, and a non-zero value with no effect otherwise. A return value of ErrorCode::k_UNSUPPORTED_ID
indicates that timeZoneid
is not recognized.
|
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.
|
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.