Interface Clock

All Known Implementing Classes:
SystemClock, TestClock

public interface Clock
Abstraction for time measurement to enable testability.

Allows tests to inject a test clock with manual time advancement instead of relying on the system clock.

  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the current time in nanoseconds.
  • Method Details

    • nanoTime

      long nanoTime()
      Returns the current time in nanoseconds.

      The absolute value is meaningless; only differences matter. This is analogous to System.nanoTime().

      Returns:
      nanoseconds since an arbitrary reference point