Package de.galan.commons.time
Class ApplicationClock
java.lang.Object
de.galan.commons.time.ApplicationClock
Clock that acts as time emitter for the application. Uses a java.time.clock.SystemClock (UTC) by default.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ClockgetClock()Returns the configured application Clock instance.static voidreset()Resets the application clock to the default.static voidSets the application clock.static voidCreates a fixed Clock.static voidCreates a fixed Clock with the input format "yyyy-MM-dd HH:mm:ss" using the local (systemDefault) timezone.static voidCreates a fixed Clock with the input format "yyyy-MM-dd'T'HH:mm:ss'Z'" using UTC as timezone.static voidCreates a fixed Clock.
-
Field Details
-
DATE_FORMAT
- See Also:
-
-
Constructor Details
-
ApplicationClock
public ApplicationClock()
-
-
Method Details
-
getClock
Returns the configured application Clock instance. -
setClock
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
Creates a fixed Clock. -
setUtc
Creates a fixed Clock. -
setUtc
Creates a fixed Clock with the input format "yyyy-MM-dd'T'HH:mm:ss'Z'" using UTC as timezone. -
setLocal
Creates a fixed Clock with the input format "yyyy-MM-dd HH:mm:ss" using the local (systemDefault) timezone.
-