Module xaos.ui.plot

Class Timestamp

    • Field Detail

      • timeStamp

        protected final BigDecimal timeStamp
        The timestamp information in seconds since the Java epoch.
    • Constructor Detail

      • Timestamp

        public Timestamp​(BigDecimal timeStamp)
        Primary constructor from the full precision seconds since the Java epoch.
        Parameters:
        timeStamp - The number of seconds since the Java epoch.
      • Timestamp

        public Timestamp​(Timestamp source)
        Copy constructor.
        Parameters:
        source - The Timestamp to be copied.
      • Timestamp

        public Timestamp​(Timestamp timeStamp)
        Construct a Timestamp from a Timestamp.
        Parameters:
        timeStamp - The SQL timestamp.
    • Method Detail

      • compareTo

        public int compareTo​(Timestamp other)
        Compare this timestamp with another timestamp.
        Specified by:
        compareTo in interface Comparable<Timestamp>
        Parameters:
        other - The timestamp with which to compare this one.
        Returns:
        0 if the timestamps are the same, negative if this is earlier than the supplied one and positive otherwise.
      • equals

        public boolean equals​(Object timeStamp)
        Determine if the given timestamp equals this one.
        Overrides:
        equals in class Object
        Parameters:
        timeStamp - The Timestamp to compare with.
        Returns:
        true if they are equals and false if not.
      • format

        public String format​(DateFormat timeFormat)
        Generate a string representation of this timestamp using the specified time format for the time format up to seconds. Subsecond time is appended using a decimal point.
        Parameters:
        timeFormat - DateFormat used to generate the string up to the subsecond part.
        Returns:
        Formatted string representation of this timestamp.
      • hashCode

        public int hashCode()
        Override the hashcode as required when overriding equals. Equality implies equality of the underlying timeStamp instance variables.
        Overrides:
        hashCode in class Object
      • toBigDecimal

        public BigDecimal toBigDecimal()
        Get the time in seconds with full precision since the Java epoch.
        Returns:
        The time in seconds since the Java epoch.
      • toDate

        public Date toDate()
        Get the times tamp as a Java Date. Some precision is lost since the Date class only supports millisecond resolution.
        Returns:
        The time stamp as a Date object.
      • toMilliseconds

        public long toMilliseconds()
        Get the timestamp in milliseconds relative to the Java epoch.
        Returns:
        The time in milliseconds since the Java epoch.
      • toSQLTimestamp

        public Timestamp toSQLTimestamp()
        Get the SQL Timestamp equivalent of this instance.
        Returns:
        The SQL Timestamp equivalent of this instance.
      • toSeconds

        public double toSeconds()
        Get the time in seconds since the Java epoch.
        Returns:
        The time in seconds since the Java epoch.
      • toString

        public String toString()
        Get a string representation of the Timestamp.
        Overrides:
        toString in class Object
        Returns:
        a string representation of the Timestamp