Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "quanta"
version = "0.12.6"
authors = ["Toby Lawrence <toby@nuclearfurnace.com>"]
edition = "2021"
rust-version = "1.70"
rust-version = "1.71"

license = "MIT"

Expand Down Expand Up @@ -51,7 +51,7 @@ raw-cpuid = "11.0"
libc = "0.2"

[target.'cfg(target_os = "windows")'.dependencies]
winapi = { version = "0.3", features = ["profileapi"] }
windows-sys = { version = "0.61", features = ["Win32_System_Performance"] }

[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
web-sys = { version = "0.3", features = ["Window", "Performance"] }
Expand Down
10 changes: 5 additions & 5 deletions src/clocks/monotonic/windows.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::mem;
use winapi::um::profileapi;
use windows_sys::Win32::System::Performance;

#[derive(Clone, Copy, Debug)]
pub struct Monotonic {
Expand All @@ -11,12 +11,12 @@ impl Monotonic {
let raw = unsafe {
// TODO: Can we do any better than the `mem::zeroed` call here?
let mut count = mem::zeroed();
if profileapi::QueryPerformanceCounter(&mut count) == 0 {
if Performance::QueryPerformanceCounter(&mut count) <= 0 {
unreachable!(
"QueryPerformanceCounter on Windows XP or later should never return zero!"
);
}
*count.QuadPart() as u64
count as u64
};
raw * self.factor
}
Expand All @@ -27,12 +27,12 @@ impl Default for Monotonic {
let denom = unsafe {
// TODO: Can we do any better than the `mem::zeroed` call here?
let mut freq = mem::zeroed();
if profileapi::QueryPerformanceFrequency(&mut freq) == 0 {
if Performance::QueryPerformanceFrequency(&mut freq) <= 0 {
unreachable!(
"QueryPerformanceFrequency on Windows XP or later should never return zero!"
);
}
*freq.QuadPart() as u64
freq as u64
};

Self {
Expand Down