See Time.Span.to_string_hum
.
Time.t is precise to approximately 0.24us in 2014. If to_span
converts to the
closest Time.Span.t
, we have stability problems: converting back yields a
different t
, sometimes different enough to have a different external
representation, because the conversion back and forth crosses a rounding boundary.
To stabilize conversion, we treat Time.t
as having 1us precision: to_span
and
of_span
both round to the nearest 1us.
Around 135y magnitudes, Time.Span.t
no longer has 1us resolution. At that point,
to_span
and of_span
raise.
The concern with stability is in part due to an earlier incarnation of
Timing_wheel
that had surprising behavior due to rounding of floating-point times.
Timing_wheel was since re-implemented to use integer Time_ns
, and to treat
floating-point Time
s as equivalence classes according to the Time_ns
that they
round to. See Timing_wheel_float
for details.