Interface NanoClock

All Known Implementing Classes:
CachedNanoClock, SystemNanoClock
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 NanoClock
Functional interface for return the current time as system-wide monotonic tick of 1 nanosecond precision.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    The number of ticks in nanoseconds the clock has advanced since starting.
  • Method Details

    • nanoTime

      long nanoTime()
      The number of ticks in nanoseconds the clock has advanced since starting.

      This method can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time. The value returned represents nanoseconds since some fixed but arbitrary origin time (perhaps in the future, so values may be negative). The same origin is used by all invocations of this method in an instance of a Java virtual machine; other virtual machine instances are likely to use a different origin.

      Returns:
      number of ticks in nanoseconds the clock has advanced since starting.
      See Also: