time-rs / time

The most used Rust library for date and time handling.
https://time-rs.github.io
Apache License 2.0
1.06k stars 261 forks source link

Switch from `winapi` to `windows-sys` #609

Closed jhpratt closed 11 months ago

jhpratt commented 11 months ago

winapi appears unmaintained and windows-sys is a crate provided by Microsoft. time should switch for that reason.

If anyone has the requisite knowledge, feel free to open a PR. I won't get to this in the next couple weeks, and even then may not be able to implement the change.

Yuri6037 commented 11 months ago

I recommend actually using windows-sys (this is what I'm using btw) which has a smaller footprint than windows-rs as this crate probably just needs some very specific Win32 functions (like GetSystemTime).

EDIT: Do not worry, windows-sys is also maintained by Microsoft it's some kind of lower-level version of windows-rs.

jhpratt commented 11 months ago

Looks like the windows-rs repo is published as the windows-sys crate. So windows-sys is in fact what I was looking at when I made the issue.

complexspaces commented 11 months ago

How many functions/constants does time use from the Win32 APIs? windows-bindgen might be the better option if its a very small number to avoid version churn and any MSRV headaches.

jhpratt commented 11 months ago

No reason. As I said above, I was looking at the repository. I haven't used Windows in almost a decade and have no feelings whatsoever on which crate to use (aside from it being maintained).

Yuri6037 commented 11 months ago

How many functions/constants does time use from the Win32 APIs? windows-bindgen might be the better option if its a very small number to avoid version churn and any MSRV headaches.

Side note, windows-bindgen is no longer maintained, the new tool is called riddle and is not available on crates.io. Instead, it's directly in the windows repository.

jhpratt commented 11 months ago

windows-bindgen had a release just a couple hours ago?

Alexendoo commented 11 months ago

Looks like standalone FFI calls that don't depend on winapi are already used - https://github.com/time-rs/time/blob/500f8e4517cb89f0aa80087130ed2f8b8349f162/time/src/sys/local_offset_at/windows.rs

jhpratt commented 11 months ago

Ha, I totally forgot that the dependency was removed a while back. winapi is nowhere to be found in current code. Closing.