Exact durations and monotonic timing
Use exact nanosecond quantities and measure a lazy loop with the process local steady clock.
Download .aner sourcelet 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.
With Aner installed, 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.
aner check examples/duration_basic.aner
aner run examples/duration_basic.anerThe aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.
Use the compatible native Aner development engine 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.
Iris and Wine are teaching datasets with their own attribution. Example outcomes are not comparative benchmarks or evidence of clinical validity.
Dataset sources & attribution