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
AClock
implementation 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 long
absoluteTimeMillis()
Gets the current absolute time, in milliseconds.void
advanceTime(long duration, TimeUnit timeUnit)
Advances the time by the given duration.void
advanceTime(Duration duration)
Advances the time by the given duration.long
relativeTimeMillis()
Gets the current relative time, in milliseconds.long
relativeTimeNanos()
Gets the current relative time, in nanoseconds.
-
-
-
Method Detail
-
absoluteTimeMillis
public long absoluteTimeMillis()
Description copied from class:Clock
Gets the current absolute time, in milliseconds.- Specified by:
absoluteTimeMillis
in classClock
-
relativeTimeMillis
public long relativeTimeMillis()
Description copied from class:Clock
Gets the current relative time, in milliseconds.- Specified by:
relativeTimeMillis
in interfaceRelativeClock
- Specified by:
relativeTimeMillis
in classClock
-
relativeTimeNanos
public long relativeTimeNanos()
Description copied from class:Clock
Gets the current relative time, in nanoseconds.- Specified by:
relativeTimeNanos
in interfaceRelativeClock
- Specified by:
relativeTimeNanos
in 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.
-
-