Classes Files

Wombat::MamaTimeZone

More…

#include <MamaTimeZone.h>

Public Functions

  Name
const MamaTimeZone &static const MamaTimeZone & utc()
const MamaTimeZone & usEastern()
void setScanningInterval(mama_f64_t seconds)
  MamaTimeZone()
  MamaTimeZone(const char * tz)
  MamaTimeZone(const MamaTimeZone & copy)
  ~MamaTimeZone()
MamaTimeZone & operator=(const MamaTimeZone & rhs)
void set(const char * tz)
void clear()
const char * tz() const
mama_i32_t offset() const
void check()
mamaTimeZone getCValue()
const mamaTimeZone getCValue() const

Detailed Description

class Wombat::MamaTimeZone;

A time zone representation to make conversion of timestamps to and from particular time zones more convenient.

Note: The addition of instance monitoring to the MamaTimeZone implementation has resulted in the following limitation in its usage. Do not create short lived objects of this type on the method stack or delete long lived objects before program termination. Pointers to all instances are maintained in a global vector. At the moment there is no mechanism by which we can detect deleted objects or those which are popped off the method stack. An internal thread will always iterate over all objects ever created. A call to an object removed from the stack will result in nondeterminable behaviour. Pointers could be stored in a map against a unique object id; however, addition and removal from the map would have to be synchronized which would impact on performance.

Public Functions Documentation

function utc

static const MamaTimeZone &static const MamaTimeZone & utc()

Return a reference to a MamaTimeZone corresponding to the local time zone. Return a reference to a MamaTimeZone corresponding to UTC time zone.

function usEastern

static const MamaTimeZone & usEastern()

Return a reference to a MamaTimeZone corresponding to the US Eastern time zone.

function setScanningInterval

static void setScanningInterval(
    mama_f64_t seconds
)

Use to set the interval of the thread updating each MamaTimeZone instance offset

function MamaTimeZone

MamaTimeZone()

Constructor.

function MamaTimeZone

MamaTimeZone(
    const char * tz
)

Constructor. NULL argument is equivalent to local timezone.

function MamaTimeZone

MamaTimeZone(
    const MamaTimeZone & copy
)

Copy constructor.

function ~MamaTimeZone

~MamaTimeZone()

Destructor.

function operator=

MamaTimeZone & operator=(
    const MamaTimeZone & rhs
)

Assignment operator.

function set

void set(
    const char * tz
)

Assign new timezones to this object.

function clear

void clear()

Clear this object.

function tz

const char * tz() const

Return the time zone string.

function offset

mama_i32_t offset() const

Return the offset from UTC (in seconds). Can be positive or negative, depending upon the direction.

function check

void check()

Check (recalculate) the UTC offset in case it has changed due to daylight savings adjustments.

function getCValue

inline mamaTimeZone getCValue()

function getCValue

inline const mamaTimeZone getCValue() const

Updated on 2023-03-31 at 15:29:26 +0100