BDE 4.14.0 Production release
Loading...
Searching...
No Matches
baltzo::LocalTimeOffsetUtil Struct Reference

#include <baltzo_localtimeoffsetutil.h>

Static Public Member Functions

static void loadLocalTimeOffset (int *result, const bdlt::Datetime &utcDatetime)
 
static bsls::TimeInterval localTimeOffset (const bdlt::Datetime &utcDatetime)
 
static bdlt::LocalTimeOffset::LocalTimeOffsetCallback setLoadLocalTimeOffsetCallback ()
 
static int configure ()
 
static int configure (const char *timezone)
 
static int configure (const char *timezone, const bdlt::Datetime &utcDatetime)
 
static void loadLocalTimePeriod (LocalTimePeriod *localTimePeriod)
 
static void loadTimezone (bsl::string *timezone)
 
static void loadTimezone (std::string *timezone)
 
static int updateCount ()
 

Detailed Description

This struct provides a namespace for a bdlt::LocalTimeOffset local time offset callback, and functions that manage the timezone information reported by that callback. All public methods are thread-safe.

Member Function Documentation

◆ configure() [1/3]

static int baltzo::LocalTimeOffsetUtil::configure ( )
static

Set the local time period information used by the localTimeOffset method to that for the time zone in the TZ environment variable at the current UTC datetime. Return 0 on success, and a non-zero value otherwise. This method is not thread-safe. The behavior is undefined if the environment changes (e.g., a call to the putenv POSIX function) during the invocation of this method.

◆ configure() [2/3]

static int baltzo::LocalTimeOffsetUtil::configure ( const char *  timezone)
static

Set the local time period information used by the localTimeOffset method to that for specified timezone at the current UTC datetime. Return 0 on success, and a non-zero value otherwise. This method is not thread-safe.

◆ configure() [3/3]

static int baltzo::LocalTimeOffsetUtil::configure ( const char *  timezone,
const bdlt::Datetime utcDatetime 
)
static

Set the local time period information used by the localTimeOffset method to that for the specified timezone at the specified utcDatetime. Return 0 on success, and a non-zero value otherwise. This method is not thread-safe.

◆ loadLocalTimeOffset()

static void baltzo::LocalTimeOffsetUtil::loadLocalTimeOffset ( int *  result,
const bdlt::Datetime utcDatetime 
)
static
Deprecated:
Use localTimeOffset instead.

Efficiently load to the specified result the offset of the local time from UTC for the specified utcDatetime. This function is thread-safe. The behavior is undefined unless the local time zone has been previously established by a call to the configure method. This method is thread-safe. Note that this function is no longer used as a callback function. It exisis for backwards compatibility with code that called it directly, and is deprecated.

◆ loadLocalTimePeriod()

static void baltzo::LocalTimeOffsetUtil::loadLocalTimePeriod ( LocalTimePeriod localTimePeriod)
static

Load to the specified localTimePeriod the local time period information currently used by the localTimeOffset method. That information is updated when localTimeOffset is called with a utcDatetime outside the range localTimePeriod().utcStartTime() (inclusive) localTimePeriod().utcEndTime() (exclusive). This method is not thread-safe. The behavior is undefined if this method is invoked before the successful invocation of a configure method.

◆ loadTimezone() [1/2]

static void baltzo::LocalTimeOffsetUtil::loadTimezone ( bsl::string timezone)
static

◆ loadTimezone() [2/2]

static void baltzo::LocalTimeOffsetUtil::loadTimezone ( std::string *  timezone)
static

Load to the specified timezone time zone identifier used to determine the local time offset from UTC. This method is not thread-safe. The behavior is undefined if this method is invoked before the successful invocation of a configure method.

◆ localTimeOffset()

static bsls::TimeInterval baltzo::LocalTimeOffsetUtil::localTimeOffset ( const bdlt::Datetime utcDatetime)
static

Return the offset of the local time from UTC for the specified utcDatetime. This function is thread-safe. The behavior is undefined unless the local time zone has been previously established by a call to the configure method. This method is thread-safe.

◆ setLoadLocalTimeOffsetCallback()

bdlt::LocalTimeOffset::LocalTimeOffsetCallback baltzo::LocalTimeOffsetUtil::setLoadLocalTimeOffsetCallback ( )
inlinestatic

Set localTimeOffset as the local time offset callback of bdlt::CurrentTime. Return the previously installed callback. This method is not thread-safe.

◆ updateCount()

int baltzo::LocalTimeOffsetUtil::updateCount ( )
inlinestatic

Return the number of successful updates of the local time period information since the start of the process. This count is incremented on calls to any of the setTimeZone methods and when loadLocalTimePeriod is called with a utcDatetime outside the range of the current local time period information. This method is thread-safe.


The documentation for this struct was generated from the following file: