Clock facade for domain code.
Domain layers MUST NOT call java.time.* or System/currentTimeMillis
directly — route through this ns so tests can pin time without
with-redefs on JVM statics.
Substitution model: java.time.Clock rebinding via *clock*.
Clock/systemDefaultZoneClock/fixed for deterministic instantsnow-* fns honor the dynamic bindingProvided primitives mirror the subset needed by hive-knowledge,
hive-mcp, and other consumers. Add new fns here, never inline
java.time.* in calling code.
Clock facade for domain code. Domain layers MUST NOT call `java.time.*` or `System/currentTimeMillis` directly — route through this ns so tests can pin time without `with-redefs` on JVM statics. Substitution model: `java.time.Clock` rebinding via `*clock*`. - Default: `Clock/systemDefaultZone` - Tests: bind to `Clock/fixed` for deterministic instants - All `now-*` fns honor the dynamic binding Provided primitives mirror the subset needed by hive-knowledge, hive-mcp, and other consumers. Add new fns here, never inline `java.time.*` in calling code.
Clock used by all now-* fns. Rebind to Clock/fixed in tests.
Clock used by all `now-*` fns. Rebind to `Clock/fixed` in tests.
(between unit-kw a b)Whole units of unit-kw between two Temporals.
unit-kw ∈ #{:nanos :micros :millis :seconds :minutes :hours :days
:weeks :months :years}.
Whole units of `unit-kw` between two Temporals.
`unit-kw` ∈ #{:nanos :micros :millis :seconds :minutes :hours :days
:weeks :months :years}.(format-temporal t pattern)Format a java.time.temporal.Temporal with the given pattern.
Format a java.time.temporal.Temporal with the given pattern.
(parse-instant s)Parse an ISO-8601 instant string.
Parse an ISO-8601 instant string.
(parse-local-date-time s)Parse an ISO-8601 local datetime string.
Parse an ISO-8601 local datetime string.
(parse-zoned-date-time s)Parse an ISO-8601 zoned datetime string.
Parse an ISO-8601 zoned datetime string.
(today-yyyy-mm-dd)Convenience: today's date as yyyy-MM-dd honoring *clock*.
Convenience: today's date as `yyyy-MM-dd` honoring `*clock*`.
(with-clock clock & body)Run body with *clock* bound to the given java.time.Clock.
Run body with `*clock*` bound to the given java.time.Clock.
(with-fixed instant & body)Run body with *clock* pinned at instant in the system default zone.
For an explicit zone, use with-fixed-in-zone.
Why split: Clojure forbids two variadic overloads on a single fn/macro (the original two-arity defmacro fails to compile with 'Can't have more than 1 variadic overload'). Splitting into two macros gives both call sites a usable surface.
Run body with `*clock*` pinned at `instant` in the system default zone. For an explicit zone, use `with-fixed-in-zone`. Why split: Clojure forbids two variadic overloads on a single fn/macro (the original two-arity defmacro fails to compile with 'Can't have more than 1 variadic overload'). Splitting into two macros gives both call sites a usable surface.
(with-fixed-in-zone instant zone & body)Run body with *clock* pinned at instant in the given zone.
Run body with `*clock*` pinned at `instant` in the given `zone`.
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 |