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
FieldsModifier and TypeFieldDescriptionstatic final TimeSourceDefault implementation that uses System.nanoTime(). -
Method Summary
Modifier and TypeMethodDescriptionlongnanoTime()Returns the current value of the running Java Virtual Machine's high-resolution time source, in nanoseconds.
-
Field Details
-
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.
-