Std\Time
Time – timestamps, sleeping, and elapsed time measurement.
Provides monotonic and wall-clock timestamps in milliseconds and microseconds, sleep, and formatted time output.
Functions
Section titled “Functions”now : Int
Section titled “now : Int”Returns the current wall-clock time in milliseconds since the Unix epoch.
import now from Std\Time innow # => 1712678400000nowMicros : Int
Section titled “nowMicros : Int”Returns the current time in microseconds since the Unix epoch.
import nowMicros from Std\Time innowMicros # => 1712678400000000epoch : Int
Section titled “epoch : Int”Returns the Unix epoch (0) as a timestamp. Useful as a base for relative calculations.
import epoch from Std\Time inepoch # => 0sleep : Int -> ()
Section titled “sleep : Int -> ()”Sleep for the given number of milliseconds.
import sleep from Std\Time insleep 1000 # sleep for 1 secondformat : Int -> String
Section titled “format : Int -> String”Format a millisecond timestamp as a human-readable date-time string.
import now, format from Std\Time informat (now) # => "2025-04-09 12:00:00"elapsed : Int -> Int -> Int
Section titled “elapsed : Int -> Int -> Int”Compute the elapsed time in milliseconds between two timestamps.
import now, elapsed, sleep from Std\Time inlet t0 = now indo sleep 100 let t1 = now in elapsed t0 t1 # => ~100end