All news

Published

Time utilities and indexed string iteration in Jik v0.1.0-alpha.28

Jik v0.1.0-alpha.28 is now available. This release adds a standard library module for time measurements and timestamps, and lets string loops access each character's index. It also removes the jik memchk command.

Measure time and pause execution

The new jik/time module provides monotonic_ms() for measuring elapsed time, unix_seconds() for basic log timestamps, and sleep(ms) for a millisecond delay. Monotonic time is measured relative to the first call in the process, so it is suitable for durations.

use "jik/time" as time

func main():
    start := time::monotonic_ms()
    time::sleep(100)
    println("elapsed ms: ", time::monotonic_ms() - start)
    println("Unix timestamp: ", time::unix_seconds())
end

Get indices while iterating over a string

String loops can now bind an index alongside each character, using the same two-variable form as indexed vector iteration.

text := "Jik"
for index, ch in text:
    println(index, ": ", ch)
end