unisecs

Crates.iounisecs
lib.rsunisecs
version0.1.0
sourcesrc
created_at2019-04-07 23:20:40.063146
updated_at2019-04-07 23:20:40.063146
descriptionUnix epoch seconds
homepagehttps://github.com/softprops/unisecs
repositoryhttps://github.com/softprops/unisecs
max_upload_size
id126424
size13,652
cargo (github:rustpq:cargo)

documentation

https://docs.rs/unisecs/

README

unisecs Build Status Coverage Status Software License crates.io Released API docs Master API docs

Unix epoch time representation that anyone can wear

🤔 About

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.

📦 Install

In your Cargo.toml file, add the following under the [dependencies] heading

unisecs = "0.1"

Usage

fn main() {
  println!(
    "{}", unisecs::Seconds::now()
  );
}

Doug Tangren (softprops) 2019

Commit count: 16

cargo fmt