* Winx now returns io::Error This commit is a spiritual follower of #1242 in the sense that it adjusts `winx` to also return `io::Error` directly rather than tossing a custom error type here and there. * Adapt wasi-common to changes in winx * Run cargo fmt * Swap overly big map_err with explicit match
12 lines
346 B
Rust
12 lines
346 B
Rust
use cvt::cvt;
|
|
use std::io::Result;
|
|
use winapi::um::{profileapi::QueryPerformanceFrequency, winnt::LARGE_INTEGER};
|
|
|
|
pub fn perf_counter_frequency() -> Result<u64> {
|
|
unsafe {
|
|
let mut frequency: LARGE_INTEGER = std::mem::zeroed();
|
|
cvt(QueryPerformanceFrequency(&mut frequency))?;
|
|
Ok(*frequency.QuadPart() as u64)
|
|
}
|
|
}
|