Duration module provides utilities for working with durations of time. A Duration is an immutable data type that represents a span of time with high precision, supporting operations from nanoseconds to weeks.
Overview
Durations support:- High precision - Nanosecond-level accuracy using BigInt
- Multiple formats - Numbers (millis), BigInt (nanos), tuples, strings
- Arithmetic operations - Add, subtract, multiply, divide
- Comparisons - Equal, less than, greater than
- Conversions - Between different time units
- Human-readable formatting - Pretty printing and parsing
Creating Durations
From Time Units
Create durations using time unit constructors.From Strings
Create durations from string literals.Special Durations
Type-Safe Input
UseDuration.Input type for flexible duration parameters.
