Crates.io | num-time-duration |
lib.rs | num-time-duration |
version | 0.1.0 |
source | src |
created_at | 2021-07-12 01:27:26.29576 |
updated_at | 2021-07-12 01:27:26.29576 |
description | Provide a convenient way to create `std::time::Duration` from numbers. |
homepage | |
repository | https://github.com/yassun4dev/num-time-duration.git |
max_upload_size | |
id | 421697 |
size | 5,570 |
This crate provides a convenient way to create std::time::Duration
from numbers.
Example:
use num_time_duration::NumTimeDuration;
let now = std::time::SystemTime::now();
assert_eq!(now + 1.hours(), now + std::time::Duration::from_secs(3600));
assert_eq!(now + 1.days(), now + std::time::Duration::from_secs(86400));
assert_eq!(now - 1.weeks(), now - std::time::Duration::from_secs(604800));
To use num-time-duration
, add this to your Cargo.toml
:
[dependencies]
num-time-duration = "0.1.0"