OpenMAMA C++ API
Wombat::MamaTimeZone Class Reference

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

#include <MamaTimeZone.h>

Public Member Functions

 MamaTimeZone ()
 Constructor. More...
 
 MamaTimeZone (const char *tz)
 Constructor. More...
 
 MamaTimeZone (const MamaTimeZone &copy)
 Copy constructor. More...
 
 ~MamaTimeZone ()
 Destructor. More...
 
MamaTimeZoneoperator= (const MamaTimeZone &rhs)
 Assignment operator. More...
 
void set (const char *tz)
 Assign new timezones to this object. More...
 
void clear ()
 Clear this object. More...
 
const char * tz () const
 Return the time zone string. More...
 
mama_i32_t offset () const
 Return the offset from UTC (in seconds). More...
 
void check ()
 Check (recalculate) the UTC offset in case it has changed due to daylight savings adjustments. More...
 
mamaTimeZone getCValue ()
 
const mamaTimeZone getCValue () const
 

Static Public Member Functions

static const MamaTimeZonelocal ()
 Return a reference to a MamaTimeZone corresponding to the local time zone. More...
 
static const MamaTimeZoneutc ()
 Return a reference to a MamaTimeZone corresponding to UTC time zone. More...
 
static const MamaTimeZoneusEastern ()
 Return a reference to a MamaTimeZone corresponding to the US Eastern time zone. More...
 
static void setScanningInterval (mama_f64_t seconds)
 Use to set the interval of the thread updating each MamaTimeZone instance offset. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

§ MamaTimeZone() [1/3]

Wombat::MamaTimeZone::MamaTimeZone ( )

Constructor.

§ MamaTimeZone() [2/3]

Wombat::MamaTimeZone::MamaTimeZone ( const char *  tz)

Constructor.

NULL argument is equivalent to local timezone.

§ MamaTimeZone() [3/3]

Wombat::MamaTimeZone::MamaTimeZone ( const MamaTimeZone copy)

Copy constructor.

§ ~MamaTimeZone()

Wombat::MamaTimeZone::~MamaTimeZone ( )

Destructor.

Member Function Documentation

§ local()

static const MamaTimeZone& Wombat::MamaTimeZone::local ( )
static

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

§ utc()

static const MamaTimeZone& Wombat::MamaTimeZone::utc ( )
static

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

§ usEastern()

static const MamaTimeZone& Wombat::MamaTimeZone::usEastern ( )
static

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

§ operator=()

MamaTimeZone& Wombat::MamaTimeZone::operator= ( const MamaTimeZone rhs)

Assignment operator.

§ set()

void Wombat::MamaTimeZone::set ( const char *  tz)

Assign new timezones to this object.

§ clear()

void Wombat::MamaTimeZone::clear ( )

Clear this object.

§ tz()

const char* Wombat::MamaTimeZone::tz ( ) const

Return the time zone string.

§ offset()

mama_i32_t Wombat::MamaTimeZone::offset ( ) const

Return the offset from UTC (in seconds).

Can be positive or negative, depending upon the direction.

§ check()

void Wombat::MamaTimeZone::check ( )

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

§ getCValue() [1/2]

mamaTimeZone Wombat::MamaTimeZone::getCValue ( )
inline

§ getCValue() [2/2]

const mamaTimeZone Wombat::MamaTimeZone::getCValue ( ) const
inline

§ setScanningInterval()

static void Wombat::MamaTimeZone::setScanningInterval ( mama_f64_t  seconds)
static

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