Class Epoch


  • public class Epoch
    extends Object
    A class encapsulating the conversion between absolute time specified as a TimeStamp and values on an Axis1D representing time.

    Values on an Axis1D representing time are usually seconds since an epoch chosen to be close to the times of interest (in order to avoid numerical precision issues, particularly with OpenGL painters which deal with axis values as floats ).

    Times Axis1D timeline are stored as seconds.

    Author:
    ulman
    • Constructor Detail

      • Epoch

        public Epoch​(long epoch_PMILLIS)
    • Method Detail

      • posixEpoch

        public static Epoch posixEpoch()
      • currentTime

        public static Epoch currentTime()
      • getTimeStamp

        public TimeStamp getTimeStamp()
      • getPosixMillis

        public long getPosixMillis()
      • toTimeStamp

        public TimeStamp toTimeStamp​(double axisValue)
        Converts a value along an Axis1D into an absolute time by interpreting the values along the Axis1D as offsets in seconds from the point in time represented by this Epoch.
        Parameters:
        axisValue - a value returned by an Axis1D
        Returns:
        a TimeStamp representing an absolute time
        See Also:
        fromTimeStamp(TimeStamp)
      • toPosixMillis

        public long toPosixMillis​(double axisValue)
        Converts a value along an Axis1D into an absolute time by interpreting the values along the Axis1D as offsets in seconds from the point in time represented by this Epoch.
        Parameters:
        axisValue - a value returned by an Axis1D
        Returns:
        a long representing an absolute time, in milliseconds since the posix epoch
        See Also:
        fromPosixMillis(long)
      • fromTimeStamp

        public double fromTimeStamp​(TimeStamp time)
        Converts a TimeStamp to a value along an Axis1D.
        Parameters:
        time - an absolute TimeStamp
        Returns:
        an Axis1D value
        See Also:
        toTimeStamp( double )
      • fromPosixMillis

        public double fromPosixMillis​(long time_PMILLIS)
        Converts a time to a value along an Axis1D.
        Parameters:
        time - an absolute time, in milliseconds since the posix epoch
        Returns:
        an Axis1D value
        See Also:
        toPosixMillis(double)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object