Liking cljdoc? Tell your friends :D

hive-ttracking.clock

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 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.
raw docstring

*clock*clj

Clock used by all now-* fns. Rebind to Clock/fixed in tests.

Clock used by all `now-*` fns. Rebind to `Clock/fixed` in tests.
sourceraw docstring

betweenclj

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

between-daysclj

(between-days a b)
source

between-hoursclj

(between-hours a b)
source

between-millisclj

(between-millis a b)
source

between-minutesclj

(between-minutes a b)
source

format-temporalclj

(format-temporal t pattern)

Format a java.time.temporal.Temporal with the given pattern.

Format a java.time.temporal.Temporal with the given pattern.
sourceraw docstring

now-instantclj

(now-instant)
source

now-local-dateclj

(now-local-date)
source

now-local-date-timeclj

(now-local-date-time)
source

now-millisclj

(now-millis)
source

now-zoned-date-timeclj

(now-zoned-date-time)
source

parse-instantclj

(parse-instant s)

Parse an ISO-8601 instant string.

Parse an ISO-8601 instant string.
sourceraw docstring

parse-local-date-timeclj

(parse-local-date-time s)

Parse an ISO-8601 local datetime string.

Parse an ISO-8601 local datetime string.
sourceraw docstring

parse-zoned-date-timeclj

(parse-zoned-date-time s)

Parse an ISO-8601 zoned datetime string.

Parse an ISO-8601 zoned datetime string.
sourceraw docstring

today-yyyy-mm-ddclj

(today-yyyy-mm-dd)

Convenience: today's date as yyyy-MM-dd honoring *clock*.

Convenience: today's date as `yyyy-MM-dd` honoring `*clock*`.
sourceraw docstring

with-clockcljmacro

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

with-fixedcljmacro

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

with-fixed-in-zonecljmacro

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

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close