Package io.aeron.cluster
Class MillisecondClusterClock
java.lang.Object
io.aeron.cluster.MillisecondClusterClock
- All Implemented Interfaces:
ClusterClock
A
ClusterClock implemented by calling System.currentTimeMillis().-
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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.aeron.cluster.service.ClusterClock
timeUnit
-
Constructor Details
-
MillisecondClusterClock
public MillisecondClusterClock()
-
-
Method Details
-
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.
-