All examples
Language

Exact durations and monotonic timing

Use exact nanosecond quantities and measure a lazy loop with the process local steady clock.

duration_basic.aner
let interval: Duration = Duration(nanoseconds: 1500000000)
let total = interval.add(Duration.from_milliseconds(250))
print(total.str())
print(total.nanoseconds())
let started = Duration.monotonic()
var checksum = 0
for index in Range(1000) {
    checksum = checksum + index
}
let elapsed = Duration.monotonic().subtract(started)
print(checksum)
print(elapsed.total_seconds())

Make it your experiment.

Use Aner 0.0.3 or newer. Save this program as examples/duration_basic.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/duration_basic.aner
aner run examples/duration_basic.aner

The aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.

Use Aner 0.0.4 or newer with import free temporal, binary, Range, Optional and Result values, and VS Code extension 0.1.37 or newer. No import is required. Calendar values use Gregorian and explicit fixed offset contracts; Bytes uses strict explicit text encoding; Range is lazy; outcome payload access is checked. See each separate native value reference for exact ownership, resource limits and time/space complexity.

Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.

Dataset sources & attribution
Install Aner