-
public class ClockA simple wrapper for system clock that aims to provide the current time
The JDK provides two clocks:
one in nanoseconds, for precision, but it can only use to measure durations one in milliseconds, for accuracy, useful to provide epoch timeAt this time, we are using a millis precision (converted to micros) in order to guarantee consistency between the span start times and the durations
-
-
Method Summary
Modifier and Type Method Description static longcurrentNanoTicks()Get the current nanos ticks, this method can't be use for date accuracy (only durationcalculations) static longcurrentMicroTime()Get the current time in micros. static longcurrentNanoTime()Get the current time in nanos. -
-
Method Detail
-
currentNanoTicks
static long currentNanoTicks()
Get the current nanos ticks, this method can't be use for date accuracy (only durationcalculations)
-
currentMicroTime
static long currentMicroTime()
Get the current time in micros. The actual precision is the millis
-
currentNanoTime
static long currentNanoTime()
Get the current time in nanos. The actual precision is the millis Note: this will overflow in~290 years after epoch
-
-
-
-