to_short_string t
pretty-prints approximate time span using no more than
five characters if the span is positive, and six if the span is negative.
Examples
"4h"
= 4 hours"5m"
= 5 minutes"4s"
= 4 seconds"10ms"
= 10 millisecondsonly the most significant denomination is shown.
to_unit_of_time t
= Day
if abs t >= day
, Hour
if abs t >= hour
, and so on
down to Microsecond
if abs t >= microsecond
, and Nanosecond
otherwise.
of_unit_of_time unit_of_time
produces a t
representing the corresponding span.
to_string_hum t ~delimiter ~decimals ~align_decimal ~unit_of_time
formats t
using
the given unit of time, or the largest appropriate units if none is specified, among
"d"=day, "h"=hour, "m"=minute, "s"=second, "ms"=millisecond, "us"=microsecond, or
"ns"=nanosecond. The magnitude of the time span in the chosen unit is formatted by:
Float.to_string_hum ~delimiter ~decimals ~strip_zero:(not align_decimal)
If align_decimal
is true, the single-character suffixes are padded with an extra
space character. In combination with not stripping zeroes, this means that the
decimal point will occur a fixed number of characters from the end of the string.