Interface TimeSource


public interface TimeSource
Interface to abstract time measurements for easier testing. This allows tests to control time advancement rather than relying on actual wall clock time.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final TimeSource
    Default implementation that uses System.nanoTime().
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the current value of the running Java Virtual Machine's high-resolution time source, in nanoseconds.
  • Field Details

    • SYSTEM

      static final TimeSource SYSTEM
      Default implementation that uses System.nanoTime().
  • Method Details

    • nanoTime

      long nanoTime()
      Returns the current value of the running Java Virtual Machine's high-resolution time source, in nanoseconds.
      Returns:
      the current value of the running Java Virtual Machine's high-resolution time source.