This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 8/19/2026.
Time
~import std/timeKoru Standard Library: Time
time.kz · 5 tors · ~[comptime]· ~[runtime]
Koru Standard Library: Time
Timing primitives for measuring code execution.
Usage:
import std/time
import std/io
std/time:now(): start |> do_work()
|> std/time:elapsed(start: start): d
|> std/io:print.ln("work: {{ d.ms:f }}ms")
// TIMESTAMP
//
// Monotonic nanoseconds since this process first asked. Only meaningful as
// one half of a difference.
~pub tor now {} -> i128elapsed
koru_std/time.kz:64// DURATION CALCULATION
//
// Calculate elapsed time since start
~pub tor elapsed { start: i128 } -> { ns: i128, us: f64, ms: f64, s: f64 }report
koru_std/time.kz:78// Print elapsed time to stderr (for use inside comptime event overrides)
~pub tor report { start: i128, label: string }// SLEEP (RUNTIME ONLY)
//
// Sleep for specified milliseconds
~[runtime] pub tor sleep-ms { ms: u64 }// Sleep for specified seconds
~[runtime] pub tor sleep-s { s: u64 }