GitHub Contributors Stars Build Status Downloads Crates.io docs.rs

# `relativetime` `relativetime` provides traits on `std::time::Duration` and `chrono::Duration` to easily display human-readable relative times. ```rust use relativetime::{RelativeTime, NegativeRelativeTime}; fn main() { let d = std::time::Duration::from_secs(1); assert_eq!(d.relative_time(), "in a few seconds"); assert_eq!(d.relative_time_in_past(), "a few seconds ago"); let d = chrono::Duration::from_secs(-1); assert_eq!(d.relative_time(), "a few seconds ago"); let d = chrono::Duration::from_secs(1); assert_eq!(d.relative_time(), "in a few seconds"); } ``` See the [`docs`](https://docs.rs/relativetime) for the API, and the [tests](https://github.com/kurtbuilds/relativetime/blob/master/src/lib.rs#L88) for more example usage. # Contributing Contributions are welcome!