Interface ClockSource

    • Field Detail

      • TIMEUNITS_DESCENDING

        static final TimeUnit[] TIMEUNITS_DESCENDING
      • TIMEUNIT_DISPLAY_VALUES

        static final String[] TIMEUNIT_DISPLAY_VALUES
    • Method Detail

      • currentTime

        static long currentTime()
        Get the current time-stamp (resolution is opaque).
        Returns:
        the current time-stamp
      • currentTime0

        long currentTime0()
      • toMillis

        static long toMillis​(long time)
        Convert an opaque time-stamp returned by currentTime() into milliseconds.
        Parameters:
        time - an opaque time-stamp returned by an instance of this class
        Returns:
        the time-stamp in milliseconds
      • toMillis0

        long toMillis0​(long time)
      • toNanos

        static long toNanos​(long time)
        Convert an opaque time-stamp returned by currentTime() into nanoseconds.
        Parameters:
        time - an opaque time-stamp returned by an instance of this class
        Returns:
        the time-stamp in nanoseconds
      • toNanos0

        long toNanos0​(long time)
      • elapsedMillis

        static long elapsedMillis​(long startTime)
        Convert an opaque time-stamp returned by currentTime() into an elapsed time in milliseconds, based on the current instant in time.
        Parameters:
        startTime - an opaque time-stamp returned by an instance of this class
        Returns:
        the elapsed time between startTime and now in milliseconds
      • elapsedMillis0

        long elapsedMillis0​(long startTime)
      • elapsedMillis

        static long elapsedMillis​(long startTime,
                                  long endTime)
        Get the difference in milliseconds between two opaque time-stamps returned by currentTime().
        Parameters:
        startTime - an opaque time-stamp returned by an instance of this class
        endTime - an opaque time-stamp returned by an instance of this class
        Returns:
        the elapsed time between startTime and endTime in milliseconds
      • elapsedMillis0

        long elapsedMillis0​(long startTime,
                            long endTime)
      • elapsedNanos

        static long elapsedNanos​(long startTime)
        Convert an opaque time-stamp returned by currentTime() into an elapsed time in milliseconds, based on the current instant in time.
        Parameters:
        startTime - an opaque time-stamp returned by an instance of this class
        Returns:
        the elapsed time between startTime and now in milliseconds
      • elapsedNanos0

        long elapsedNanos0​(long startTime)
      • elapsedNanos

        static long elapsedNanos​(long startTime,
                                 long endTime)
        Get the difference in nanoseconds between two opaque time-stamps returned by currentTime().
        Parameters:
        startTime - an opaque time-stamp returned by an instance of this class
        endTime - an opaque time-stamp returned by an instance of this class
        Returns:
        the elapsed time between startTime and endTime in nanoseconds
      • elapsedNanos0

        long elapsedNanos0​(long startTime,
                           long endTime)
      • plusMillis

        static long plusMillis​(long time,
                               long millis)
        Return the specified opaque time-stamp plus the specified number of milliseconds.
        Parameters:
        time - an opaque time-stamp
        millis - milliseconds to add
        Returns:
        a new opaque time-stamp
      • plusMillis0

        long plusMillis0​(long time,
                         long millis)
      • getSourceTimeUnit

        static TimeUnit getSourceTimeUnit()
        Get the TimeUnit the ClockSource is denominated in.
        Returns:
        the TimeUnit the ClockSource is denominated in.
      • getSourceTimeUnit0

        TimeUnit getSourceTimeUnit0()
      • elapsedDisplayString

        static String elapsedDisplayString​(long startTime,
                                           long endTime)
        Get a String representation of the elapsed time in appropriate magnitude terminology.
        Parameters:
        startTime - an opaque time-stamp
        endTime - an opaque time-stamp
        Returns:
        a string representation of the elapsed time interval
      • elapsedDisplayString0

        default String elapsedDisplayString0​(long startTime,
                                             long endTime)