Class Ticker


  • @Beta
    @GwtCompatible
    public abstract class Ticker
    extends java.lang.Object
    A time source; returns a time value representing the number of nanoseconds elapsed since some fixed but arbitrary point in time. Note that most users should use Stopwatch instead of interacting with this class directly.

    Warning: this interface can only be used to measure elapsed time, not wall time.

    Since:
    10.0 (mostly source-compatible since 9.0)
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract long read()
      Returns the number of nanoseconds elapsed since this ticker's fixed point of reference.
      static Ticker systemTicker()
      A ticker that reads the current time using System.nanoTime().
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • read

        public abstract long read()
        Returns the number of nanoseconds elapsed since this ticker's fixed point of reference.
      • systemTicker

        public static Ticker systemTicker()
        A ticker that reads the current time using System.nanoTime().
        Since:
        10.0