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`.
(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.
(iso-str)(iso-str millis)An instant — epoch milliseconds, defaulting to now — as an ISO-8601 / RFC 3339 UTC string.
Millisecond precision, matching java.time.Instant/toString: no fractional
part on a whole second, exactly three digits otherwise. (iso-str 0) is
"1970-01-01T00:00:00Z" and (iso-str 1500) is "1970-01-01T00:00:01.500Z"
on every host.
An instant — epoch milliseconds, defaulting to now — as an ISO-8601 / RFC 3339 UTC string. Millisecond precision, matching `java.time.Instant/toString`: no fractional part on a whole second, exactly three digits otherwise. `(iso-str 0)` is "1970-01-01T00:00:00Z" and `(iso-str 1500)` is "1970-01-01T00:00:01.500Z" on every host.
(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.
(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`.
(parse-iso s)An ISO-8601 / RFC 3339 timestamp as epoch milliseconds, as a long.
The fractional part is optional and an offset is honoured rather than dropped, so "…T12:00:00+05:30" and "…T06:30:00Z" parse equal. Throws, naming the input, when the string is not an instant.
An ISO-8601 / RFC 3339 timestamp as epoch milliseconds, as a long. The fractional part is optional and an offset is honoured rather than dropped, so "…T12:00:00+05:30" and "…T06:30:00Z" parse equal. Throws, naming the input, when the string is not an instant.
(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).
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 |