Crates.io | basic_timer |
lib.rs | basic_timer |
version | 1.0.0 |
source | src |
created_at | 2021-01-13 00:41:52.383393 |
updated_at | 2021-01-13 00:41:52.383393 |
description | A basic timer implementation for benchmarking |
homepage | https://github.com/trentshailer/basic_timer |
repository | https://github.com/trentshailer/basic_timer |
max_upload_size | |
id | 341180 |
size | 3,312 |
This project is a basic implementation of a timer in rust made to be lightweight and accurate.
Initialize the timer with
let timer = Timer::new();
Then to get the time
let time = timer.get_time(duration_type: DurationType);
This returns a u128
duration_type can be one of the following:
DurationType::Seconds
DurationType::Milliseconds
DurationType::Microseconds
DurationType::Nanoseconds
use basic_timer::{Timer, DurationType};
fn main() {
let timer = Timer::new();
std::thread::sleep(std::time::Duration::new(5, 0));
let time = timer.get_time(DurationType::Milliseconds);
}