#time #fundamental #general-purpose #collection

no-std time_tools

Collection of general purpose time tools

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

#2388 in Development tools

Download history 5/week @ 2024-01-29 11/week @ 2024-02-05 26/week @ 2024-02-12 39/week @ 2024-02-19 51/week @ 2024-02-26 42/week @ 2024-03-04 153/week @ 2024-03-11 70/week @ 2024-03-18 44/week @ 2024-03-25 78/week @ 2024-04-01 31/week @ 2024-04-08 28/week @ 2024-04-15 43/week @ 2024-04-22 37/week @ 2024-04-29 50/week @ 2024-05-06 54/week @ 2024-05-13

190 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