Skip to main content

scale_duration

Function scale_duration 

Source
pub fn scale_duration(a: DurationParts, factor: f64) -> DurationParts
Expand description

duration * factor / duration / factor (factor is 1.0 / n for division) – re-cascades through the same AVG_MONTH_DAYS-based logic normalize_duration uses (scaling a whole month by a non-integer factor produces a fractional month again, e.g. P1M / 2 needs to become “15.2 days”, not stay a fractional month), so this calls the shared cascade directly with months/days pre-multiplied and the exact seconds+nanos total pre-multiplied as one i128 quantity (truncated, same “no phantom sub-nanosecond digit” reasoning as normalize_duration’s extra_nanos).