TestClock
Keywords: net.corda.testing.node.TestClock class
Date: 2023-09-18

net.corda.testing.node

## Class TestClock

- net.corda.testing.node.TestClock

-     @ThreadSafe
      public class TestClock

  A Clock that can have the time advanced for use in testing.

  See Also:
    Clock

- - ### Constructor Detail

    - #### TestClock

          public TestClock(@NotNull
                           java.time.Clock delegateClock)

      A Clock that can have the time advanced for use in testing.

      See Also:
        Clock

  - ### Method Detail

    - #### advanceBy

          @Synchronized
          public void advanceBy(@NotNull
                                              java.time.Duration duration)

      Advance this Clock by the specified Duration for testing purposes.

      See Also:
        Clock, Duration

    - #### setTo

          @Synchronized
          public void setTo(@NotNull
                                          java.time.Instant newInstant)

      Move this Clock to the specified Instant for testing purposes. This will only be approximate due to the time ticking away, but will be some time shortly after the requested Instant.

      See Also:
        Clock, Instant, Instant