Liking cljdoc? Tell your friends :D

java-time.mock


advance-clock!clj

(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.
sourceraw docstring

mock-clockclj

(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.
sourceraw docstring

set-clock!clj

(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.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close