Class MamaTimeZone


  • public class MamaTimeZone
    extends java.lang.Object
    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.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Equals override.
      java.util.TimeZone getJavaTimzone()
      Return a java.util.TimeZone object for this MamaTimeZone.
      int hashCode()
      Hashcode override.
      static MamaTimeZone local()
      Return a reference to a MamaTimeZone corresponding to the local time zone.
      int offset()
      Return the offset from UTC (in seconds).
      void set​(java.lang.String tz)
      Assign new timezones to this object.
      java.lang.String tz()
      Return the time zone string.
      static MamaTimeZone usEastern()
      Return a reference to a MamaTimeZone corresponding to the US Eastern time zone.
      static MamaTimeZone utc()
      Return a reference to a MamaTimeZone corresponding to UTC time zone.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
    • 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:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Hashcode override.
        Overrides:
        hashCode in class java.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.