Classes Files

com::wombat::mama::MamaTimeZone

More…

Public Functions

  Name
static MamaTimeZone()
MamaTimeZone utc()
MamaTimeZone usEastern()
  MamaTimeZone()
  MamaTimeZone(String tz)
  MamaTimeZone(MamaTimeZone copy)
boolean equals(Object obj)
int hashCode()
void set(String tz)
String tz()
int offset()
TimeZone getJavaTimzone()

Detailed Description

class com::wombat::mama::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 MamaTimeZone

static inline static MamaTimeZone()

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

function utc

static inline MamaTimeZone utc()

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

function usEastern

static inline MamaTimeZone usEastern()

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

function MamaTimeZone

inline MamaTimeZone()

Constructor.

The default for C/C++ sets TZ=”TZ” which appears to be no timezone (date in bash reports the correct local time with no timezone. For now, we will just use the local timezone. I am not sure if this is correct.

function MamaTimeZone

inline MamaTimeZone(
    String tz
)

Constructor. NULL argument is equivalent to local timezone.

function MamaTimeZone

inline MamaTimeZone(
    MamaTimeZone copy
)

Copy constructor.

function equals

inline boolean equals(
    Object obj
)

Equals override. Two timezones are equal if they represent the same timezone

function hashCode

inline int hashCode()

Hashcode override.

function set

inline void set(
    String tz
)

Assign new timezones to this object.

function tz

inline String tz()

Return the time zone string.

function offset

inline int offset()

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

This might be inefficient if this method gets called alot. In the C/C++ implementation, the offset is cached and a spearate thread updates them at regular intervals. We may not need this for Java clients.

function getJavaTimzone

inline TimeZone getJavaTimzone()

Return a java.util.TimeZone object for this MamaTimeZone.


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