compact-reltime
This is a small and simple libraray crate providing compact, human-readable, string formatting for approximated durations of time. The compact format represents a duration in terms of one or two distinct time units which are abbreviated by a single character. The precision of the string format is 1 second for short durations and generally decreases as the duration increases.
Duration strings generated by this crate have the following format:
xxuyyv
Where xx and yy are small integers, and u and v are single-character abbreviations of one
of the following units of time:
| Units | Abbreviation |
|---|---|
| Seconds | s |
| Minutes | m |
| Hours | h |
| Days | d |
| Weeks | w |
| Months | M |
| Years | y |
For example, a duration of 3,204,898 seconds would be formatted as 5w2d (5 weeks and 2 days), and
a duration of 324 seconds would be formatted as 5m24s.
Limitations
This crate does not support durations greater than 99y11M. This is to ensure the format is always less than 7 characters in length. It also does not presently support languages other than English or durations with sub-second precision.