Crates.io | unisecs |
lib.rs | unisecs |
version | 0.1.0 |
source | src |
created_at | 2019-04-07 23:20:40.063146 |
updated_at | 2019-04-07 23:20:40.063146 |
description | Unix epoch seconds |
homepage | https://github.com/softprops/unisecs |
repository | https://github.com/softprops/unisecs |
max_upload_size | |
id | 126424 |
size | 13,652 |
Unix epoch time representation that anyone can wear
Why not std::time
? Rust's std::time
package provides two representations of time SystemTime
and Instant
. Often times you will need to work with an api that requires specifically unix time which typically is represented in terms of seconds. std::time
representations are general purpose can can be made to represent unix time but not in a very straightforward or ergonomic way.
This crate does focuses specifically on that in addition to represented subsecond time for the purposes of capturing a more accuate measurement of a duration.
Unix seconds is a type of duration, anchored from a starting point of 00:00:00 UTC Thursday, 1 January 1970
. On most unix-based systems you can get this time on the command line with date +%s
. This crate aims to provide similiar convenience in addition to having good interop with other features in std::time
module.
In your Cargo.toml file, add the following under the [dependencies] heading
unisecs = "0.1"
fn main() {
println!(
"{}", unisecs::Seconds::now()
);
}
Doug Tangren (softprops) 2019