Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std.os.windows: implement <timeapi.h> #8801

Merged
merged 2 commits into from
Jun 11, 2021
Merged

Conversation

0x08088405
Copy link
Contributor

This PR adds bindings to the minimal timeapi.h interface, which is very useful for configuring the system timer resolution to get accurate Sleep() and such. Since this API is part of WinMM, a new file has been created for it, following the current pattern of one file per system library with the two basic WinMM types that timeapi.h depends on added as well.

I've also tested all the functions just in case since there's very few of them.

@daurnimator daurnimator added os-windows standard library This issue involves writing Zig code for the standard library. labels May 17, 2021
@lithdew
Copy link
Contributor

lithdew commented May 17, 2021

For the tests you've done, is it possible to include them since the API surface is small?

@0x08088405
Copy link
Contributor Author

0x08088405 commented May 17, 2021

For the tests you've done, is it possible to include them since the API surface is small?

Do you mean in the form of a Zig testcase? The actual results are entirely hardware dependent, if that's what you're asking.

@lithdew
Copy link
Contributor

lithdew commented May 17, 2021

For the tests you've done, is it possible to include them since the API surface is small?

Do you mean in the form of a Zig testcase? The actual results are entirely hardware dependent, if that's what you're asking.

How about a smoke test just to check that the methods themselves can be used?

@0x08088405
Copy link
Contributor Author

0x08088405 commented May 17, 2021

For the tests you've done, is it possible to include them since the API surface is small?

Do you mean in the form of a Zig testcase? The actual results are entirely hardware dependent, if that's what you're asking.

How about a smoke test just to check that the methods themselves can be used?

I looked in the other std.os.windows.* files and they didn't contain any "smoke tests" either, so I'll withhold from that for now, but can do if a collaborator requests such a thing. The issue is calling them at all adjusts your system timer and this can actually be system-global before Win10 2004, I don't think a test should mess with that.

@Vexu
Copy link
Member

Vexu commented Jun 8, 2021

Looks like this should be exposed in lib/std/os/windows.zig.

@0x08088405
Copy link
Contributor Author

@Vexu You're totally right, my bad. Actually committed referencing the file now.

@Vexu Vexu merged commit 2ce033f into ziglang:master Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os-windows standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants