Skip to main content

duration_to_precision_units

Function duration_to_precision_units 

Source
fn duration_to_precision_units(
    duration: Duration,
    precision: SupportedPrecision,
    literal_kind: &'static str,
    span: Span<'_>,
) -> Result<i64, MessageParseError>
Expand description

Convert a chrono::Duration to the units implied by precision. Errors if duration overflows the target unit’s i64 range, or if duration carries a fractional component finer than precision can represent (e.g. .999 seconds can’t be represented exactly at precision 0).