Class ApplicationClock


  • public class ApplicationClock
    extends Object
    Clock that acts as time emitter for the application. Uses a java.time.clock.SystemClock (UTC) by default.
    • Constructor Detail

      • ApplicationClock

        public ApplicationClock()
    • Method Detail

      • getClock

        public static Clock getClock()
        Returns the configured application Clock instance.
      • setClock

        public static void setClock​(Clock clock)
        Sets the application clock. This should be done only at startup (usually not necessary), or in unit tests.
      • reset

        public static void reset()
        Resets the application clock to the default.
      • setIso

        public static void setIso​(Instant time)
        Creates a fixed Clock.
      • setUtc

        public static void setUtc​(Date time)
        Creates a fixed Clock.
      • setUtc

        public static void setUtc​(String time)
        Creates a fixed Clock with the input format "yyyy-MM-dd'T'HH:mm:ss'Z'" using UTC as timezone.
      • setLocal

        public static void setLocal​(String time)
        Creates a fixed Clock with the input format "yyyy-MM-dd HH:mm:ss" using the local (systemDefault) timezone.