Crate time_tools

Source
Expand description

Collection of time tools.

§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

Modules§

dependency
Dependencies.
exposed
Exposed namespace of the module.
ms
Default units are milliseconds.
now
Operates over current time.
ns
Default units are nanoseconds.
orphan
Shared with parent namespace of the module
prelude
Prelude to use essentials: use my_module::prelude::*.
protected
Protected namespace of the module.
s
Default units are seconds.

Functions§

now
Get current time. Units are milliseconds.