Package org.agrona.concurrent
Class HighResolutionClock
java.lang.Object
org.agrona.concurrent.HighResolutionClock
Clock that provides the number of time units since the 1 Jan 1970 UTC.
This implementation may be replaced on some platforms for greater performance.
Note: The actual provided resolution may be a higher granularity than the possible precision. For example, on Java 8 many JVMs will only advance a millisecond per tick so when requesting micros or nanos then the returned time may be a multiple of milliseconds. Later JVMs tend to improve on this.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic long
The number of microseconds since the 1 Jan 1970 UTC.static long
The number of milliseconds since the 1 Jan 1970 UTC.static long
The number of nanoseconds since the 1 Jan 1970 UTC.
-
Constructor Details
-
HighResolutionClock
private HighResolutionClock()
-
-
Method Details
-
epochMillis
public static long epochMillis()The number of milliseconds since the 1 Jan 1970 UTC.- Returns:
- the number of milliseconds since the 1 Jan 1970 UTC.
-
epochMicros
public static long epochMicros()The number of microseconds since the 1 Jan 1970 UTC.- Returns:
- the number of microseconds since the 1 Jan 1970 UTC.
-
epochNanos
public static long epochNanos()The number of nanoseconds since the 1 Jan 1970 UTC.Precision depends upon the JVM version used. Hotspot/OpenJDK 8 provides millisecond level precision, 11 provides microsecond or lower granularity.
- Returns:
- the number of nanoseconds since the 1 Jan 1970 UTC.
-