Try to somehow implement clock_res_get on Windows. (#124)
* Implement clock_time_get on Windows. Also update misc_testsuite to include latest clock_time_get test changes. * Try to somehow implement clock_res_get on Windows. * Fix 55ms * Cache the perf counter resolution * Fix integration tests
This commit is contained in:
committed by
Jakub Konka
parent
3757b8b1c2
commit
22494057df
@@ -25,6 +25,7 @@
|
||||
extern crate bitflags;
|
||||
|
||||
pub mod file;
|
||||
pub mod time;
|
||||
pub mod winerror;
|
||||
|
||||
use winerror::WinError;
|
||||
|
||||
10
winx/src/time.rs
Normal file
10
winx/src/time.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
use cvt::cvt;
|
||||
use winapi::um::{profileapi::QueryPerformanceFrequency, winnt::LARGE_INTEGER};
|
||||
|
||||
pub fn perf_counter_frequency() -> std::io::Result<u64> {
|
||||
unsafe {
|
||||
let mut frequency: LARGE_INTEGER = std::mem::zeroed();
|
||||
cvt(QueryPerformanceFrequency(&mut frequency))?;
|
||||
Ok(*frequency.QuadPart() as u64)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user