Liking cljdoc? Tell your friends :D

koine.time

Wall-clock time, monotonic elapsed time and sleeping, portable.

toolnexus SPEC §8 stamps a ms duration on every llm/tool/run metric event and its retry policy sleeps between attempts, so durations are load-bearing: measure them with mono-ms/elapsed-ms (never with now-ms, which the operating system can move backwards) and stamp events with now-ms.

Wall-clock time, monotonic elapsed time and sleeping, portable.

toolnexus SPEC §8 stamps a `ms` duration on every llm/tool/run metric event
and its retry policy sleeps between attempts, so durations are load-bearing:
measure them with `mono-ms`/`elapsed-ms` (never with `now-ms`, which the
operating system can move backwards) and stamp events with `now-ms`.
raw docstring

elapsed-msclj/s

(elapsed-ms start)

Milliseconds elapsed since start, which must be a mono-ms reading.

Milliseconds elapsed since `start`, which must be a `mono-ms` reading.
raw docstring

mono-msclj/s

(mono-ms)

A monotonic elapsed-time counter in milliseconds, as a long.

Only DIFFERENCES between two readings are meaningful — the origin differs per host. Guaranteed never to go backwards.

JVM (System/nanoTime), Glojure (Go's monotonic clock, via time.Since on a process anchor) and cljgo (cljg.date/nano-time, monotonic nanos since process start) have a true monotonic source. let-go does NOT: its System/nanoTime is time.Now().UnixNano(), i.e. wall clock with no monotonic reading (pkg/rt/system.go:121). There it FALLS BACK to wall clock, clamped to a high-water mark so a backwards clock step shows as zero elapsed rather than a negative duration.

A monotonic elapsed-time counter in milliseconds, as a long.

Only DIFFERENCES between two readings are meaningful — the origin differs
per host. Guaranteed never to go backwards.

JVM (System/nanoTime), Glojure (Go's monotonic clock, via time.Since on a
process anchor) and cljgo (`cljg.date/nano-time`, monotonic nanos since
process start) have a true monotonic source. let-go does NOT: its
System/nanoTime is `time.Now().UnixNano()`, i.e. wall clock with no monotonic
reading (pkg/rt/system.go:121). There it FALLS BACK to wall clock, clamped to
a high-water mark so a backwards clock step shows as zero elapsed rather than
a negative duration.
raw docstring

now-msclj/s

(now-ms)

Wall-clock time in milliseconds since the Unix epoch, as a long.

Suitable for timestamps. NOT suitable for measuring a duration — use mono-ms.

Wall-clock time in milliseconds since the Unix epoch, as a long.

Suitable for timestamps. NOT suitable for measuring a duration — use
`mono-ms`.
raw docstring

sleep!clj/s

(sleep! ms)

Block the current thread for ms milliseconds. Returns nil.

A non-positive ms returns immediately (the JVM's Thread/sleep throws on a negative argument; the Go-hosted dialects return at once — koine normalises to the latter).

Block the current thread for `ms` milliseconds. Returns nil.

A non-positive `ms` returns immediately (the JVM's Thread/sleep throws on a
negative argument; the Go-hosted dialects return at once — koine normalises
to the latter).
raw 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