6 releases

0.2.0 Mar 16, 2024
0.1.4 Jun 13, 2022
0.1.3 May 31, 2022
0.1.0 Jan 10, 2022

#2681 in Development tools

Download history 66/week @ 2024-07-22 106/week @ 2024-07-29 18/week @ 2024-08-05 33/week @ 2024-08-12 13/week @ 2024-08-19 23/week @ 2024-08-26 4/week @ 2024-09-02 15/week @ 2024-09-09 19/week @ 2024-09-16 48/week @ 2024-09-23 27/week @ 2024-09-30 12/week @ 2024-10-07 74/week @ 2024-10-14 46/week @ 2024-10-21 25/week @ 2024-10-28 15/week @ 2024-11-04

160 downloads per month
Used in 5 crates (via wtools)

MIT license

9KB
87 lines

Module :: time_tools

experimental rust-status docs.rs Open in Gitpod discord

Collection of general purpose time tools.

Basic use-case

#[ cfg( feature = "chrono" ) ]
{
  use time_tools::*;

  /* get milliseconds from UNIX epoch */
  let now = time::now();
  println!( "now {}", now );

  /* get nanoseconds from UNIX epoch */
  let now = time::now();
  let now_ns = time::ns::now();
  assert_eq!( now, now_ns / 1000000 );

  /* get seconds from UNIX epoch */
  let now = time::now();
  let now_s = time::s::now();
  assert_eq!( now / 1000, now_s );
}

To add to your project

cargo add time_tools

Try out from the repository

git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/time_tools_trivial
cargo run

Sample

discord Open in Gitpod docs.rs

No runtime deps