fn round_span_invariant(
span: Span,
largest: Unit,
increment: &Increment,
mode: RoundMode,
) -> Result<Span, Error>Expand description
Rounds a span consisting of only invariant units.
This only applies when the max of the units in the span being rounded,
the largest configured unit and the smallest configured unit are all
invariant. That is, hours or lower for spans without a relative datetime,
or weeks or lower for spans with a SpanRelativeTo::days_are_24_hours()
marker.
All we do here is convert the span to an integer number of nanoseconds, round that and then convert back. There aren’t any tricky corner cases to consider here.