Quick Links:

bal | bbl | bdl | bsl

Public Types | Static Public Member Functions

bdlt::CurrentTime Struct Reference

#include <bdlt_currenttime.h>

List of all members.

Public Types

typedef bsls::TimeInterval(* CurrentTimeCallback )()

Static Public Member Functions

static Datetime local ()
static bsls::TimeInterval now ()
static Datetime utc ()
static DatetimeTz asDatetimeTz ()
static CurrentTimeCallback currentTimeCallback ()
static CurrentTimeCallback setCurrentTimeCallback (CurrentTimeCallback callback)
static bsls::TimeInterval currentTimeDefault ()

Detailed Description

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).

See Component bdlt_currenttime


Member Typedef Documentation

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.


Member Function Documentation

static Datetime bdlt::CurrentTime::local (  )  [static]

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.

static bsls::TimeInterval bdlt::CurrentTime::now (  )  [static]

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.

static Datetime bdlt::CurrentTime::utc (  )  [static]

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

static DatetimeTz bdlt::CurrentTime::asDatetimeTz (  )  [static]

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.

static CurrentTimeCallback bdlt::CurrentTime::currentTimeCallback (  )  [static]

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

static CurrentTimeCallback bdlt::CurrentTime::setCurrentTimeCallback ( CurrentTimeCallback  callback  )  [static]

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.

static bsls::TimeInterval bdlt::CurrentTime::currentTimeDefault (  )  [static]

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. On UNIX (Solaris, LINUX and DG-UNIX) this function provides a microsecond resolution. On Windows (NT, WIN2000, 95, 98 etc) it provides a resolution of 100 nanoseconds.


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