1 unstable release

0.1.0 Apr 7, 2019

#20 in #epoch

MIT license

11KB
181 lines

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

Dependencies

~100–335KB