Skip to content

Std\Time

Time – timestamps, sleeping, and elapsed time measurement.

Provides monotonic and wall-clock timestamps in milliseconds and microseconds, sleep, and formatted time output.

Returns the current wall-clock time in milliseconds since the Unix epoch.

import now from Std\Time in
now # => 1712678400000

Returns the current time in microseconds since the Unix epoch.

import nowMicros from Std\Time in
nowMicros # => 1712678400000000

Returns the Unix epoch (0) as a timestamp. Useful as a base for relative calculations.

import epoch from Std\Time in
epoch # => 0

Sleep for the given number of milliseconds.

import sleep from Std\Time in
sleep 1000 # sleep for 1 second

Format a millisecond timestamp as a human-readable date-time string.

import now, format from Std\Time in
format (now) # => "2025-04-09 12:00:00"

Compute the elapsed time in milliseconds between two timestamps.

import now, elapsed, sleep from Std\Time in
let t0 = now in
do
sleep 100
let t1 = now in
elapsed t0 t1 # => ~100
end