Package org.apache.flink.util.clock
Class Clock
- java.lang.Object
-
- org.apache.flink.util.clock.Clock
-
- All Implemented Interfaces:
RelativeClock
- Direct Known Subclasses:
ManualClock
,SystemClock
@PublicEvolving public abstract class Clock extends Object implements RelativeClock
A clock that gives access to time. This clock returns two flavors of time:Absolute Time
This refers to real world wall clock time, and it is typically derived from a system clock. It is subject to clock drift and inaccuracy, and can jump if the system clock is adjusted. Absolute time behaves similar to
System.currentTimeMillis()
.Relative Time
This time advances at the same speed as the absolute time, but the timestamps can only be referred to relative to each other. The timestamps have no absolute meaning and cannot be compared across JVM processes. The source for the timestamps is not affected by adjustments to the system clock, so it never jumps. Relative time behaves similar to
System.nanoTime()
.
-
-
Constructor Summary
Constructors Constructor Description Clock()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract long
absoluteTimeMillis()
Gets the current absolute time, in milliseconds.abstract long
relativeTimeMillis()
Gets the current relative time, in milliseconds.abstract long
relativeTimeNanos()
Gets the current relative time, in nanoseconds.
-
-
-
Method Detail
-
absoluteTimeMillis
public abstract long absoluteTimeMillis()
Gets the current absolute time, in milliseconds.
-
relativeTimeMillis
public abstract long relativeTimeMillis()
Gets the current relative time, in milliseconds.- Specified by:
relativeTimeMillis
in interfaceRelativeClock
-
relativeTimeNanos
public abstract long relativeTimeNanos()
Gets the current relative time, in nanoseconds.- Specified by:
relativeTimeNanos
in interfaceRelativeClock
-
-