Class Clock.Fast

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
    Enclosing class:
    Clock

    public static class Clock.Fast
    extends Clock
    implements java.io.Closeable
    Fast clock implementation whose getTime() method returns instantaneously thanks to a background task that takes care of the actual time-keeping work.
    • Constructor Detail

      • Fast

        public Fast​(java.util.concurrent.ScheduledExecutorService executor)
    • Method Detail

      • getTime

        public long getTime()
        Description copied from class: Clock
        Returns the current time in milliseconds since the epoch.
        Specified by:
        getTime in class Clock
        Returns:
        current time in milliseconds since the epoch
        See Also:
        System.currentTimeMillis(), Clock.millis()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable