| Crates.io | time-clock |
| lib.rs | time-clock |
| version | 0.1.0 |
| created_at | 2022-03-07 07:26:49.097557+00 |
| updated_at | 2022-03-07 07:26:49.097557+00 |
| description | Clock program |
| homepage | |
| repository | https://github.com/rise0chen/clock_source.git |
| max_upload_size | |
| id | 544872 |
| size | 12,255 |
Returns the processor time consumed by the program.
Add this to your Cargo.toml:
[dependencies]
time-clock = "*"
use core::time::Duration;
use std::thread;
let start = time_clock::clock();
thread::sleep(Duration::from_millis(100));
let end = time_clock::clock();
println!("start: {:?}", start);
println!("end: {:?}", end);
assert!((end - start) / time_clock::CLOCKS_PER_MILLI > 100)