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

TrySubtractDurations

Combines mixed integer duration representations using the wider RightRep count.

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.

fn

pub const fn TrySubtractDurations<LeftRep, RightRep, const LeftNumerator: u64, const LeftDenominator: u64,
    const RightNumerator: u64, const RightDenominator: u64>(
    Left: readonly Duration<LeftRep, LeftNumerator, LeftDenominator>&,
    Right: readonly Duration<RightRep, RightNumerator, RightDenominator>&) -> Result<Duration<RightRep, CommonDurationNumerator(LeftNumerator, LeftDenominator, RightNumerator, RightDenominator), CommonDurationDenominator(LeftNumerator, LeftDenominator, RightNumerator, RightDenominator)>, DurationError>
    where LeftRep: Data, DurationCount where RightRep: Data, DurationCount, WideningNumeric<LeftRep>

Combines mixed integer duration representations using the wider RightRep count. LeftRep: Exact left numeric count representation. RightRep: Exact right numeric count representation. LeftNumerator: Positive left unit seconds numerator. LeftDenominator: Positive left unit seconds denominator. RightNumerator: Positive right unit seconds numerator. RightDenominator: Positive right unit seconds denominator. Left: Finite left duration borrowed only during common-period combination. Right: Finite right duration borrowed only during common-period combination. Return: Selected wider-representation common-unit result or checked range error.

fn

pub const fn operator -<LeftRep, RightRep, const LeftNumerator: u64, const LeftDenominator: u64,
    const RightNumerator: u64, const RightDenominator: u64>(
    Left: readonly Duration<LeftRep, LeftNumerator, LeftDenominator>&,
    Right: readonly Duration<RightRep, RightNumerator, RightDenominator>&) -> Duration<RightRep, CommonDurationNumerator(LeftNumerator, LeftDenominator, RightNumerator, RightDenominator), CommonDurationDenominator(LeftNumerator, LeftDenominator, RightNumerator, RightDenominator)>
    where LeftRep: Data, DurationCount where RightRep: Data, DurationCount, WideningNumeric<LeftRep>

Combines mixed integer duration representations using the wider RightRep count. LeftRep: Exact left numeric count representation. RightRep: Exact right numeric count representation. LeftNumerator: Positive left unit seconds numerator. LeftDenominator: Positive left unit seconds denominator. RightNumerator: Positive right unit seconds numerator. RightDenominator: Positive right unit seconds denominator. Left: Finite left duration borrowed only during common-period combination. Right: Finite right duration borrowed only during common-period combination. Return: Selected wider-representation common-unit result with checked failure trapping, never Endless.

fn

pub const fn TrySubtractDurations<LeftRep, RightRep, const LeftNumerator: u64, const LeftDenominator: u64,
    const RightNumerator: u64, const RightDenominator: u64>(
    Left: readonly Duration<LeftRep, LeftNumerator, LeftDenominator>&,
    Right: readonly Duration<RightRep, RightNumerator, RightDenominator>&) -> Result<Duration<LeftRep, CommonDurationNumerator(LeftNumerator, LeftDenominator, RightNumerator, RightDenominator), CommonDurationDenominator(LeftNumerator, LeftDenominator, RightNumerator, RightDenominator)>, DurationError>
    where LeftRep: Data, DurationCount, WideningNumeric<RightRep> where RightRep: Data, DurationCount

Combines mixed integer duration representations using the wider LeftRep count. LeftRep: Exact left numeric count representation. RightRep: Exact right numeric count representation. LeftNumerator: Positive left unit seconds numerator. LeftDenominator: Positive left unit seconds denominator. RightNumerator: Positive right unit seconds numerator. RightDenominator: Positive right unit seconds denominator. Left: Finite left duration borrowed only during common-period combination. Right: Finite right duration borrowed only during common-period combination. Return: Selected wider-representation common-unit result or checked range error.

fn

pub const fn operator -<LeftRep, RightRep, const LeftNumerator: u64, const LeftDenominator: u64,
    const RightNumerator: u64, const RightDenominator: u64>(
    Left: readonly Duration<LeftRep, LeftNumerator, LeftDenominator>&,
    Right: readonly Duration<RightRep, RightNumerator, RightDenominator>&) -> Duration<LeftRep, CommonDurationNumerator(LeftNumerator, LeftDenominator, RightNumerator, RightDenominator), CommonDurationDenominator(LeftNumerator, LeftDenominator, RightNumerator, RightDenominator)>
    where LeftRep: Data, DurationCount, WideningNumeric<RightRep> where RightRep: Data, DurationCount

Combines mixed integer duration representations using the wider LeftRep count. LeftRep: Exact left numeric count representation. RightRep: Exact right numeric count representation. LeftNumerator: Positive left unit seconds numerator. LeftDenominator: Positive left unit seconds denominator. RightNumerator: Positive right unit seconds numerator. RightDenominator: Positive right unit seconds denominator. Left: Finite left duration borrowed only during common-period combination. Right: Finite right duration borrowed only during common-period combination. Return: Selected wider-representation common-unit result with checked failure trapping, never Endless.

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