Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
Development · Evolving reference

DurationScale

Stores a positive reduced source-to-target duration count multiplier.

Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. 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.

DurationScale

pub struct DurationScale

Stores a positive reduced source-to-target duration count multiplier.

Declarative defaults form the identity scale; other values come from validated DurationPeriod algebra through a named factory. Conversion uses a bounded two-word256-bit product and exact quotient/remainder so intermediate overflow alone never rejects a representable unsigned128 target magnitude. No allocation, storage retention, floating approximation or synchronization is introduced.

DurationScale.fn

pub readonly const fn ConvertMagnitude(Magnitude: u128, Negative: bool, Rounding: DurationRounding)
        -> Result<u128, DurationError>

Converts an exact integer magnitude using selected signed rounding direction. Magnitude: Unsigned count magnitude, including the full signed-minimum magnitude. Negative: Whether the original nonzero count has a negative sign. Rounding: Exact, mathematical floor/ceil or nearest-even selection. Return: Converted unsigned magnitude or precision/range failure; never Endless.

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