Skip to content

Commit 228241b

Browse files
authored
Merge pull request #112 from rust-random/windows-sys
rand_jitter: Migrate from winapi to windows-sys and bump version
2 parents 8f59889 + ff70dc3 commit 228241b

4 files changed

Lines changed: 106 additions & 53 deletions

File tree

Cargo.lock

Lines changed: 97 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rand_jitter/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.6.1] - 2026-05-16
8+
### Changes
9+
- Migrate from `winapi` to `windows-sys`
10+
711
## [0.6.0] - 2026-02-01
812
### Changes
913
- Use Edition 2024 and MSRV 1.85 ([#73])

rand_jitter/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rand_jitter"
3-
version = "0.6.0"
3+
version = "0.6.1"
44
authors = ["The Rand Project Developers"]
55
license = "MIT OR Apache-2.0"
66
readme = "README.md"
@@ -28,4 +28,4 @@ log = { version = "0.4.4", optional = true }
2828
libc = { version = "0.2", default-features = false }
2929

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

rand_jitter/src/platform.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ pub fn get_nstime() -> u64 {
3434

3535
#[cfg(target_os = "windows")]
3636
pub fn get_nstime() -> u64 {
37-
use winapi;
38-
37+
let mut t = 0i64;
3938
unsafe {
40-
let mut t = super::mem::zeroed();
41-
winapi::um::profileapi::QueryPerformanceCounter(&mut t);
42-
*t.QuadPart() as u64
39+
windows_sys::Win32::System::Performance::QueryPerformanceCounter(&mut t);
4340
}
41+
t as u64
4442
}

0 commit comments

Comments
 (0)