Class IeTime56


  • public class IeTime56
    extends InformationElement
    Represents a seven octet binary time (CP56Time2a) information element.
    • Constructor Summary

      Constructors 
      Constructor Description
      IeTime56​(byte[] value)
      Creates a valid Time56 instance using the given byte array and the default time zone.
      IeTime56​(long timestamp)
      Creates a valid Time56 instance using the given timestamp and the default time zone.
      IeTime56​(long timestamp, java.util.TimeZone timeZone, boolean invalid)
      Creates a Time56 instance using the given timestamp and time zone.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getDayOfMonth()
      Returns the day of the month.
      int getDayOfWeek()
      Returns the day of the week.
      int getHour()
      Returns the hour of the day.
      int getMillisecond()
      Returns the millisecond of the second.
      int getMinute()
      Returns the minute of the hour.
      int getMonth()
      Returns the month of the year.
      int getSecond()
      Returns the second of the minute.
      long getTimestamp()
      Returns the timestamp in ms equivalent to this Time56 instance.
      long getTimestamp​(int startOfCentury)
      Returns the timestamp in ms equivalent to this Time56 instance.
      long getTimestamp​(int startOfCentury, java.util.TimeZone timeZone)
      Returns the timestamp in ms equivalent to this Time56 instance.
      java.util.TimeZone getTimeZone()
      Returns the configured time zone.
      int getYear()
      Returns the year in the century.
      boolean isInvalid()
      Return true if time value is invalid.
      boolean isSummerTime()
      Returns true if summer time (i.e.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • IeTime56

        public IeTime56​(long timestamp,
                        java.util.TimeZone timeZone,
                        boolean invalid)
        Creates a Time56 instance using the given timestamp and time zone.
        Parameters:
        timestamp - the timestamp that shall be used to calculate Time56
        timeZone - the time zone to use
        invalid - true if the time shall be marked as invalid
      • IeTime56

        public IeTime56​(long timestamp)
        Creates a valid Time56 instance using the given timestamp and the default time zone.
        Parameters:
        timestamp - the timestamp that shall be used to calculate Time56
      • IeTime56

        public IeTime56​(byte[] value)
        Creates a valid Time56 instance using the given byte array and the default time zone.
        Parameters:
        value - a Time56 decoded byte array that shall be set
    • Method Detail

      • getTimestamp

        public long getTimestamp​(int startOfCentury,
                                 java.util.TimeZone timeZone)
        Returns the timestamp in ms equivalent to this Time56 instance. Note that Time56 does not store the century of the date. Therefore you have to pass the earliest possible year of the Time56 instance. Say the year stored by Time56 is 10. From this information alone it is not possible to tell whether the real year is 1910 or 2010 or 2110. If you pass 1970 as the start of century, then this function will know that the year of the given date lies between 1970 and 2069 and can therefore calculate that the correct date is 2010.
        Parameters:
        startOfCentury - The timestamp will
        timeZone - the timezone that shall be used to calculate the timestamp.
        Returns:
        the timestamp in ms equivalent to this Time56 instance
      • getTimestamp

        public long getTimestamp​(int startOfCentury)
        Returns the timestamp in ms equivalent to this Time56 instance. The default time zone is used if no time zone is configured. Note that Time56 does not store the century of the date. Therefore you have to pass the earliest possible year of the Time56 instance. Say the year stored by Time56 is 10. From this information alone it is not possible to tell whether the real year is 1910 or 2010 or 2110. If you pass 1970 as the start of century, then this function will know that the year of the given date lies between 1970 and 2069 and can therefore calculate that the correct date is 2010.
        Parameters:
        startOfCentury - The timestamp will
        Returns:
        the timestamp in ms equivalent to this Time56 instance
      • getTimestamp

        public long getTimestamp()
        Returns the timestamp in ms equivalent to this Time56 instance. Assumes that the given date is between 1970 and 2070.The default time zone is used if no time zone is configured.
        Returns:
        the timestamp in ms equivalent to this Time56 instance
      • getTimeZone

        public java.util.TimeZone getTimeZone()
        Returns the configured time zone.
        Returns:
        the used time zone
      • getMillisecond

        public int getMillisecond()
        Returns the millisecond of the second. Returned values can range from 0 to 999.
        Returns:
        the millisecond of the second
      • getSecond

        public int getSecond()
        Returns the second of the minute. Returned values can range from 0 to 59.
        Returns:
        the second of the minute
      • getMinute

        public int getMinute()
        Returns the minute of the hour. Returned values can range from 0 to 59.
        Returns:
        the minute of the hour
      • getHour

        public int getHour()
        Returns the hour of the day. Returned values can range from 0 to 23.
        Returns:
        the hour of the day
      • getDayOfWeek

        public int getDayOfWeek()
        Returns the day of the week. Returned values can range from 1 (Monday) to 7 (Sunday).
        Returns:
        the day of the week
      • getDayOfMonth

        public int getDayOfMonth()
        Returns the day of the month. Returned values can range from 1 to 31.
        Returns:
        the day of the month
      • getMonth

        public int getMonth()
        Returns the month of the year. Returned values can range from 1 (January) to 12 (December).
        Returns:
        the month of the year
      • getYear

        public int getYear()
        Returns the year in the century. Returned values can range from 0 to 99. Note that the century is not stored by Time56.
        Returns:
        the number of years in the century
      • isSummerTime

        public boolean isSummerTime()
        Returns true if summer time (i.e. Daylight Saving Time (DST)) is active.
        Returns:
        true if summer time (i.e. Daylight Saving Time (DST)) is active
      • isInvalid

        public boolean isInvalid()
        Return true if time value is invalid.
        Returns:
        true if time value is invalid