fractional_duration

Function fractional_duration 

Source
fn fractional_duration(
    unit: Unit,
    fraction: i32,
) -> Result<SignedDuration, Error>
Expand description

Converts the fraction of the given unit to a signed duration.

Since a signed duration doesn’t keep track of individual units, there is no loss of fidelity between it and ISO 8601 durations like there is for Span. Thus, we can do something far less complicated.

§Panics

When fraction isn’t in the range -999_999_999..=999_999_999.

§Errors

This returns an error if unit is not Hour, Minute, Second, Millisecond or Microsecond.