1 个不稳定版本

0.1.0 2022年3月7日

#5 in #consumed

Download history 37/week @ 2024-03-16 53/week @ 2024-03-23 65/week @ 2024-03-30 30/week @ 2024-04-06 78/week @ 2024-04-13 68/week @ 2024-04-20 32/week @ 2024-04-27 34/week @ 2024-05-04 34/week @ 2024-05-11 24/week @ 2024-05-18 32/week @ 2024-05-25 39/week @ 2024-06-01 32/week @ 2024-06-08 25/week @ 2024-06-15 32/week @ 2024-06-22 6/week @ 2024-06-29

每月102 次下载
11 个 crate 中使用 (通过 clock_source)

自定义许可证

6KB

time-clock

返回程序消耗的处理器时间。

用法

将此添加到您的 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)

无运行时依赖