Package com.wombat.mama
Class MamaTimeZone
- java.lang.Object
-
- com.wombat.mama.MamaTimeZone
-
public class MamaTimeZone extends java.lang.ObjectA 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 Summary
Constructors Constructor Description MamaTimeZone()Constructor.MamaTimeZone(MamaTimeZone copy)Copy constructor.MamaTimeZone(java.lang.String tz)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Equals override.java.util.TimeZonegetJavaTimzone()Return a java.util.TimeZone object for this MamaTimeZone.inthashCode()Hashcode override.static MamaTimeZonelocal()Return a reference to a MamaTimeZone corresponding to the local time zone.intoffset()Return the offset from UTC (in seconds).voidset(java.lang.String tz)Assign new timezones to this object.java.lang.Stringtz()Return the time zone string.static MamaTimeZoneusEastern()Return a reference to a MamaTimeZone corresponding to the US Eastern time zone.static MamaTimeZoneutc()Return a reference to a MamaTimeZone corresponding to UTC time zone.
-
-
-
Constructor Detail
-
MamaTimeZone
public MamaTimeZone()
Constructor.
-
MamaTimeZone
public MamaTimeZone(java.lang.String tz)
Constructor. NULL argument is equivalent to local timezone.
-
MamaTimeZone
public MamaTimeZone(MamaTimeZone copy)
Copy constructor.
-
-
Method Detail
-
local
public static MamaTimeZone local()
Return a reference to a MamaTimeZone corresponding to the local time zone.
-
utc
public static MamaTimeZone utc()
Return a reference to a MamaTimeZone corresponding to UTC time zone.
-
usEastern
public static MamaTimeZone usEastern()
Return a reference to a MamaTimeZone corresponding to the US Eastern time zone.
-
equals
public boolean equals(java.lang.Object obj)
Equals override. Two timezones are equal if they represent the same timezone- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
Hashcode override.- Overrides:
hashCodein classjava.lang.Object
-
set
public void set(java.lang.String tz)
Assign new timezones to this object.
-
tz
public java.lang.String tz()
Return the time zone string.
-
offset
public int offset()
Return the offset from UTC (in seconds). Can be positive or negative, depending upon the direction.
-
getJavaTimzone
public java.util.TimeZone getJavaTimzone()
Return a java.util.TimeZone object for this MamaTimeZone.
-
-