Class MonotonicClock
java.lang.Object
java.time.Clock
com.eqixiac.equinix.core.internal.MonotonicClock
- All Implemented Interfaces:
InstantSource
A
Clock whose millis() advances with System.nanoTime(): it is monotonic,
so a wall-clock adjustment (NTP step, DST, a manual change) can neither shorten nor extend an
elapsed-time measurement. It is the default time source of the SDK's elapsed-time logic (for
example CircuitBreaker cooldowns); tests
substitute a controllable Clock instead of sleeping.
The instant it reports is anchored to the wall clock once, at class initialisation, so it is only meaningful for measuring durations, not as a calendar time.
- Author:
- ianjones
-
Method Summary
Methods inherited from class Clock
equals, fixed, hashCode, offset, system, systemDefaultZone, systemUTC, tick, tickMillis, tickMinutes, tickSeconds
-
Method Details
-
get
-
getZone
-
withZone
Only UTC is supported: the clock exists to measure durations, where a zone is meaningless.- Specified by:
withZonein interfaceInstantSource- Specified by:
withZonein classClock- Throws:
UnsupportedOperationException- for any zone other than UTC
-
millis
public long millis()- Specified by:
millisin interfaceInstantSource- Overrides:
millisin classClock
-
instant
- Specified by:
instantin interfaceInstantSource- Specified by:
instantin classClock
-