Interface Clock

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface Clock
    An abstraction for how time passes. It is passed to Timer to track timing.
    • Field Detail

      • DEFAULT

        static final Clock DEFAULT
        A clock implementation which returns the current time in epoch nanoseconds.
      • THREAD_CPU_TIME

        static final Clock THREAD_CPU_TIME
        A clock implementation which returns the current thread's CPU time.
    • Method Detail

      • getTick

        long getTick()
        Returns the current time tick.
        Returns:
        time tick in nanoseconds
      • getTime

        default long getTime()
        Returns the current time in milliseconds.
        Returns:
        time in milliseconds
      • defaultClock

        static Clock defaultClock()
        The default clock to use.
        Returns:
        the DEFAULT Clock instance