time_tools

Crates.iotime_tools
lib.rstime_tools
version0.2.0
sourcesrc
created_at2022-01-10 14:47:46.181663
updated_at2024-03-16 17:06:26.23988
descriptionCollection of general purpose time tools.
homepagehttps://github.com/Wandalen/wTools/tree/master/module/core/time_tools
repositoryhttps://github.com/Wandalen/wTools/tree/master/module/core/time_tools
max_upload_size
id511441
size27,834
Wandalen (Wandalen)

documentation

https://docs.rs/time_tools

README

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

Commit count: 0

cargo fmt