compact-reltime 0.1.0

Compact relative time formatting
Documentation
  • Coverage
  • 61.11%
    11 out of 18 items documented2 out of 9 items with examples
  • Size
  • Source code size: 16.81 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 591.92 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • pezcore

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.