-
Notifications
You must be signed in to change notification settings - Fork 2
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
[WIP] Windows and Darwin support #1
base: master
Are you sure you want to change the base?
Conversation
See: https://www.python.org/dev/peps/pep-0418/#monotonic-clocks For Windows: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724411%28v=vs.85%29.aspx For Darwin: https://developer.apple.com/library/content/qa/qa1398/_index.html This adds a new optional parameter, INCLUDE-SUSPEND-P that reflects how the different platform specific clocks handle system suspension.
Hey, thanks for the pull request! Here are some comments:
|
The usage is pretty much copied from examples from the official documentation of the respective OS. In all cases they are values that do not change during system run time. I think it makes sense to compute the value only once, at load time.
I would argue that the API is portable, with the default value of The upside of formalizing the platform realities is that someone could write
if they care about the specific behavior, and have it fail on platforms where the implementation does not meet the requirements. I think that’s a feature.
Absolutely! I merely meant to share the work. |
May I ask why you prefer |
The article says that for "some hardware systems" running Windows 2000/XP it may give different results on different cores - I am not worried about those systems. The PEP (from 2012) also lists VirtualBox bugs, at least some of which are fixed. I don't know what they mean when they speak about frequency that varies with workload - they don't give any further information, and this contradicts Microsoft's documentation. There is also the Chromium comment that says it's "unreliable" on "Ahtlon X2 CPUs (model 15)" - I guess it's a joke to bring it up in a PEP because otherwise it's sad. The biggest gotcha when using this API is described in this paragraph from Microsoft's documentation:
We could mention this in the README. P.S. A cynical me notes in passing that this PEP also demonstrates Google's corporate influence on Python. Politics are not out of the question either, as the arguments presented straddle the borders of FUD. |
I don’t have any horse in this race, and just for the record, didn’t notice any bias in the PEP (honestly, I didn’t notice QPC until after you told me). I welcome an alternative implementation, but it won’t be me to supply it as I know too little about Windows APIs. If we could verify that QPC does not include time suspended that would also simplify the API. The PEP is unsure about it, and I couldn’t really find anything about it on the net. |
Just bumping the PR since I am interested in its outcome. |
Hey phoe, would you be interested in working on this? |
I could, though I'd need a while to set up my Windows/Darwin environment. What needs to be done? |
Basically what I wrote in the first comment in this issue. |
Sketch for Windows and Darwin support. I haven’t actually tested this since I do not own a Mac or Windows license. This is basically Clozure/ccl#46 translated to this library.
See: https://www.python.org/dev/peps/pep-0418/#monotonic-clocks
For Windows: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724411%28v=vs.85%29.aspx
For Darwin: https://developer.apple.com/library/content/qa/qa1398/_index.html
This adds a new optional parameter, INCLUDE-SUSPEND-P that reflects how
the different platform specific clocks handle system suspension.