This struct provides a namespace for current‐time‐retrieval procedures including a configurable global callback mechanism. The use of a subset of these procedures is thread‐safe (see Thread Safety).

Synopsis

Declared in <bdlt_currenttime.h>

struct CurrentTime;

Type Aliases

Name

Description

CurrentTimeCallback

CurrentTimeCallback is a callback function pointer for a callback function that returns a bsls::TimeInterval object. This function must be thread‐safe in multi‐threaded builds.

Static Member Functions

Name

Description

asDatetimeTz

Return the DatetimeTz value representing the current date/time in the local time zone, and the local time zone's offset from UTC, as provided by the installed callback function and the facilities of LocalTimeOffset.

currentTimeCallback

Return the installed function used to retrieve the interval between EpochUtil::epoch() and the current date/time,

currentTimeDefault

Return the TimeInterval value between EpochUtil::epoch() and the current date/time. This is the default current‐time callback implementation for current time retrieval. The obtained time is expressed as a time interval from 00:00 UTC, January 1, 1970. The resolution is: * Unix DG‐Unix: microsecond resolution

local

Return the Datetime value representing the current date/time in the local time zone, as provided by the installed callback function and the facilities of LocalTimeOffset.

now

Return the TimeInterval value between EpochUtil::epoch() and the current date/time as provided by the installed callback function. Note that this value is independent of time zone.

setCurrentTimeCallback

Set the specified callback as the function to be used to retrieve the interval between EpochUtil::epoch() and the current date/time, and return the previously set function.

utc

Return the Datetime value representing the current date/time in Coordinated Universal Time (UTC) as provided by the installed callback function.

Created with MrDocs