Package org.apache.flink.util.clock
Class ManualClock
- java.lang.Object
-
- org.apache.flink.util.clock.Clock
-
- org.apache.flink.util.clock.ManualClock
-
- All Implemented Interfaces:
RelativeClock
@PublicEvolving public final class ManualClock extends Clock
AClockimplementation which allows to advance time manually.
-
-
Constructor Summary
Constructors Constructor Description ManualClock()ManualClock(long startTime)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longabsoluteTimeMillis()Gets the current absolute time, in milliseconds.voidadvanceTime(long duration, TimeUnit timeUnit)Advances the time by the given duration.voidadvanceTime(Duration duration)Advances the time by the given duration.longrelativeTimeMillis()Gets the current relative time, in milliseconds.longrelativeTimeNanos()Gets the current relative time, in nanoseconds.
-
-
-
Method Detail
-
absoluteTimeMillis
public long absoluteTimeMillis()
Description copied from class:ClockGets the current absolute time, in milliseconds.- Specified by:
absoluteTimeMillisin classClock
-
relativeTimeMillis
public long relativeTimeMillis()
Description copied from class:ClockGets the current relative time, in milliseconds.- Specified by:
relativeTimeMillisin interfaceRelativeClock- Specified by:
relativeTimeMillisin classClock
-
relativeTimeNanos
public long relativeTimeNanos()
Description copied from class:ClockGets the current relative time, in nanoseconds.- Specified by:
relativeTimeNanosin interfaceRelativeClock- Specified by:
relativeTimeNanosin classClock
-
advanceTime
public void advanceTime(long duration, TimeUnit timeUnit)Advances the time by the given duration. Time can also move backwards by supplying a negative value. This method performs no overflow check.
-
advanceTime
public void advanceTime(Duration duration)
Advances the time by the given duration. Time can also move backwards by supplying a negative value. This method performs no overflow check.
-
-