Package io.micrometer.core.instrument
Class MockClock
- java.lang.Object
-
- io.micrometer.core.instrument.MockClock
-
-
Constructor Summary
Constructors Constructor Description MockClock()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longadd(long amount, java.util.concurrent.TimeUnit unit)longadd(java.time.Duration duration)longaddSeconds(long amount)static MockClockclock(MeterRegistry registry)longmonotonicTime()Current time from a monotonic clock source.longwallTime()Current wall time in milliseconds since the epoch.
-
-
-
Method Detail
-
monotonicTime
public long monotonicTime()
Description copied from interface:ClockCurrent time from a monotonic clock source. The value is only meaningful when compared with another snapshot to determine the elapsed time for an operation. The difference between two samples will have a unit of nanoseconds. The returned value is typically equivalent to System.nanoTime.- Specified by:
monotonicTimein interfaceClock- Returns:
- Monotonic time in nanoseconds
-
wallTime
public long wallTime()
Description copied from interface:ClockCurrent wall time in milliseconds since the epoch. Typically equivalent to System.currentTimeMillis. Should not be used to determine durations. Used for timestamping metrics being pushed to a monitoring system or for determination of step boundaries (e.g.StepLong.
-
add
public long add(long amount, java.util.concurrent.TimeUnit unit)
-
add
public long add(java.time.Duration duration)
-
addSeconds
public long addSeconds(long amount)
-
clock
public static MockClock clock(MeterRegistry registry)
-
-