Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
0.2.0 Preview 1 · Frozen documentation

DurationCount

Proves finite count encoding and checked duration decoding for one representation. Built-in integer/IEEE counts bind the existing allocation-free source operations. Exact mathematical magnitude is independent of native timer width; conversion applies explicit rounding and reports finite range/precision failures. No count becomes endless through this protocol. No borrowed input is retained. Lifecycle/Data eligibility remains separately required by Duration.

Sn is under heavy development. Reference extracted from this release’s bundled standard library. Public API examples are not an exhaustive compatibility test. Read the matching release guide for tested workflows and limitations. Read the status →

Module std.time

import std.time;

Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.

DurationCount

pub concept DurationCount<Self>

Proves finite count encoding and checked duration decoding for one representation. Built-in integer/IEEE counts bind the existing allocation-free source operations. Exact mathematical magnitude is independent of native timer width; conversion applies explicit rounding and reports finite range/precision failures. No count becomes endless through this protocol. No borrowed input is retained. Lifecycle/Data eligibility remains separately required by Duration. Self: Exact count representation, including its signed/IEEE behavior.

DurationCount.IsFiniteDurationCount

requires static fn IsFiniteDurationCount(Value: Self) -> bool;

Classifies a count before constructing a finite duration. Value: Count to classify. Return: True for finite values.

DurationCount.EncodeDurationMagnitude

requires static fn EncodeDurationMagnitude(Value: Self) -> DurationMagnitude;

Encodes an exact count into representation-independent magnitude facts. Value: Exact count. Return: Owned exact magnitude.

DurationCount.DecodeDurationMagnitude

requires static fn DecodeDurationMagnitude(Value: readonly DurationMagnitude&, Scale: DurationScale,
        Rounding: DurationRounding, Witness: Self) -> Result<Self, DurationError>;

Decodes exact magnitude into the destination with explicit rounding. Value: Exact source facts. Scale: Reduced source-to-target scale. Rounding: Precision policy. Witness: Exact destination type witness. Return: Owned count or finite conversion error.

DurationCount.DecodeCombinedDurationCount

requires static fn DecodeCombinedDurationCount(Value: readonly DurationRationalCount&, Witness: Self) -> Result<Self, DurationError>;

Decodes a combined rational count without intermediate rounding. Value: Exact combined count. Witness: Exact destination type witness. Return: Owned count or finite range/precision error.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library