millisecond-0.4.0 has been yanked.
Millisecond crate
A better way to format and display time, which converts 33023448000ms to 1y 17d 5h 10m 48s
Install
In your Rust project root directory run:
$ cargo add millisecond
Example
use *;
Options
Customize the parser and the output format using the MillisecondOption struct.
| Option | Description |
|---|---|
long |
When enabled, uses full and descriptive labels for time units, such as years instead of abbreviated forms like y. |
days_instead_of_years |
When activated, displays time durations in days rather than converting them into years. |
Option creating shorthand
In order to easily create a MillisecondOption instance, you can use the MillisecondOption::default() method:
let option = MillisecondOption;
License
MIT
Inspiration
This crate is inspired by pretty-ms npm package.