Interface Timer

All Known Implementing Classes:
ManualTimer, SystemTimer

public interface Timer
This interface wraps access to some timer that can be used to measure elapsed time, in milliseconds. This abstraction allows for unit testing the behavior of time-based constructs.
Author:
Simon Thoresen Hult
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Timer
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default Instant
     
    long
    Returns the current value of some arbitrary timer, in milliseconds.
    static Timer
    wrap(Clock original)
     
  • Field Details

    • monotonic

      static final Timer monotonic
  • Method Details

    • milliTime

      long milliTime()
      Returns the current value of some arbitrary timer, in milliseconds. This method can only be used to measure elapsed time and is not related to any other notion of system or wall-clock time.
      Returns:
      The current value of the timer, in milliseconds.
    • wrap

      static Timer wrap(Clock original)
    • instant

      default Instant instant()