Interface NanoClock
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A monotonic clock in nanoseconds, injected into the connection layer so that timers can be
driven deterministically in tests. The components of this package never read a clock; they take
now as an argument, which the connection reads from its NanoClock.
Times from one clock are compared directly, so a clock must not wrap during a connection's
lifetime (System.nanoTime() wraps after 292 years).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longThe time that is not set, used where a time is optional. -
Method Summary
-
Field Details
-
NONE
static final long NONEThe time that is not set, used where a time is optional. No clock returns it.- See Also:
-
-
Method Details
-
nanoTime
long nanoTime()The current time.- Returns:
- nanoseconds from an arbitrary origin, never
NONE
-
system
The system's monotonic clock.- Returns:
- a clock backed by
System.nanoTime()
-