easy-timer

Crates.ioeasy-timer
lib.rseasy-timer
version1.0.2
sourcesrc
created_at2021-01-13 00:05:28.570803
updated_at2021-01-13 00:33:50.586648
descriptionA basic timer implementation for benchmarking
homepagehttps://github.com/trentshailer/easy-timer
repositoryhttps://github.com/trentshailer/easy-timer
max_upload_size
id341151
size3,170
Trent Shailer (TrentShailer)

documentation

README

Easy Timer

About

This project is a basic implementation of a timer in rust made to be lightweight and accurate.

Usage

Initialize the timer with

let timer = easy_timer::Timer::new();

Then to get the time

let time = timer.get_time(duration_type: easy_timer::DurationType); This returns a u128

duration_type can be one of the following:

  • DurationType::Seconds
  • DurationType::Milliseconds
  • DurationType::Microseconds
  • DurationType::Nanoseconds

Example

fn main() {
	let timer = easy_timer::Timer::new();
	std::thread::sleep(std::time::Duration::new(5, 0));
	let time = timer.get_time(easy_timer::DurationType::milliseconds);
}
Commit count: 0

cargo fmt