Class ManualClock

  • All Implemented Interfaces:
    RelativeClock

    @PublicEvolving
    public final class ManualClock
    extends Clock
    A Clock implementation which allows to advance time manually.
    • Constructor Detail

      • ManualClock

        public ManualClock()
      • ManualClock

        public ManualClock​(long startTime)
    • Method Detail

      • absoluteTimeMillis

        public long absoluteTimeMillis()
        Description copied from class: Clock
        Gets the current absolute time, in milliseconds.
        Specified by:
        absoluteTimeMillis in class Clock
      • 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.