Initialize local time in timeZoneId from localTime.

Synopsis

Declared in <baltzo_timezoneutilimp.h>

static
int
initLocalTime(
    bdlt::DatetimeTz* result,
    LocalTimeValidity::Enum* resultValidity,
    bdlt::Datetime const& localTime,
    char const* timeZoneId,
    DstPolicy::Enum dstPolicy,
    ZoneinfoCache* cache);

Description

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, using the specified dstPolicy to interpret whether or not localTime represents a daylight‐saving time value, and using time zone information supplied by the specified cache. Load, into the specified resultValidity the value indicating the whether localTime is unique, ambiguous but valid, or invalid. Return 0 on success, and a non‐zero value otherwise. A return status of ErrorCode::k_UNSUPPORTED_ID indicates that timeZoneId is not recognized. The behavior is undefined unless the result of the initialization falls within the supported epoch.

Return Value

0 on success, and a non‐zero value otherwise

Parameters

Name

Description

result

receives the initialized local date‐time

resultValidity

receives the validity of localTime

localTime

local date‐time to interpret

timeZoneId

identifier of the time zone for localTime

dstPolicy

daylight‐saving policy for interpreting localTime

cache

zoneinfo cache supplying time zone data

Created with MrDocs