Class BatchClock

java.lang.Object
io.jenkins.plugins.batchcontrol.store.BatchClock

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public final class BatchClock extends Object
Single source of time for the whole plugin. All time reads go through this holder so tests can install a fixed Clock instead of manipulating the system clock or waiting on timers.
  • Method Details

    • clock

      public static Clock clock()
      The current clock (system default zone unless a test installed another one).
    • now

      public static Instant now()
      Current instant according to clock().
    • setForTest

      public static void setForTest(Clock testClock)
      Installs a fixed/offset clock for tests. Always pair with reset().
    • reset

      public static void reset()
      Restores the system default zone clock.