Package io.aeron.cluster
Class NanosecondClusterClock
java.lang.Object
io.aeron.cluster.NanosecondClusterClock
- All Implemented Interfaces:
ClusterClock
A
ClusterClock implemented by calling HighResolutionClock.epochNanos().-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongconvertToNanos(long time) Convert given Cluster time toTimeUnit.NANOSECONDS.longtime()The count ofClusterClock.timeUnit()s since 1 Jan 1970 UTC.longGet the current time inTimeUnit.MICROSECONDS.longGet the current time inTimeUnit.MILLISECONDS.longGet the current time inTimeUnit.NANOSECONDS.timeUnit()The unit of time returned from theClusterClock.time()method.
-
Constructor Details
-
NanosecondClusterClock
public NanosecondClusterClock()
-
-
Method Details
-
timeUnit
The unit of time returned from theClusterClock.time()method.- Specified by:
timeUnitin interfaceClusterClock- Returns:
- the unit of time returned from the
ClusterClock.time()method.
-
time
public long time()The count ofClusterClock.timeUnit()s since 1 Jan 1970 UTC.- Specified by:
timein interfaceClusterClock- Returns:
- the count of
ClusterClock.timeUnit()s since 1 Jan 1970 UTC.
-
timeMillis
public long timeMillis()Get the current time inTimeUnit.MILLISECONDS.- Specified by:
timeMillisin interfaceClusterClock- Returns:
- the current time in
TimeUnit.MILLISECONDS.
-
timeMicros
public long timeMicros()Get the current time inTimeUnit.MICROSECONDS.- Specified by:
timeMicrosin interfaceClusterClock- Returns:
- the current time in
TimeUnit.MICROSECONDS.
-
timeNanos
public long timeNanos()Get the current time inTimeUnit.NANOSECONDS.- Specified by:
timeNanosin interfaceClusterClock- Returns:
- the current time in
TimeUnit.NANOSECONDS.
-
convertToNanos
public long convertToNanos(long time) Convert given Cluster time toTimeUnit.NANOSECONDS.- Specified by:
convertToNanosin interfaceClusterClock- Parameters:
time- to convert to nanoseconds.- Returns:
- time in
TimeUnit.NANOSECONDS.
-