(advance-clock! clock amount)Advances the clock by the given time amount.
This mutates the mock clock.
Advances the `clock` by the given time `amount`. This mutates the mock clock.
(mock-clock)(mock-clock instant)(mock-clock instant zone)Returns a mock implementation of the java.time.Clock. The mock supports
advance-clock! operation which allows to move the time in the clock, e.g.:
(let [clock (mock-clock 0 "UTC")] (with-clock clock (is (= (value clock) 0)) (is (= (instant) (instant 0))) (advance-clock! clock (j/millis 1)) (is (= (value clock) 1)) (is (= (instant) (instant 1)))))
You can move the clock back via advancing by a negative temporal amount.
Creates a clock at epoch in the default timezone when called without arguments.
Returns a mock implementation of the `java.time.Clock`. The mock supports
`advance-clock!` operation which allows to move the time in the clock, e.g.:
(let [clock (mock-clock 0 "UTC")]
(with-clock clock
(is (= (value clock) 0))
(is (= (instant) (instant 0)))
(advance-clock! clock (j/millis 1))
(is (= (value clock) 1))
(is (= (instant) (instant 1)))))
You can move the clock back via advancing by a negative temporal amount.
Creates a clock at epoch in the default timezone when called without arguments.(set-clock! clock time)Sets the clock to the given time.
This mutates the mock clock.
Sets the `clock` to the given `time`. This mutates the mock clock.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |