gh-63207: Use GetSystemTimePreciseAsFileTime() in time.time()#116822
gh-63207: Use GetSystemTimePreciseAsFileTime() in time.time()#116822vstinner merged 1 commit intopython:mainfrom
Conversation
|
Clock resolution measured by the script: #116781 (comment) Before: After:
|
|
On a release build (build using Well, more and more operating have two clocks: one slow but accurate, and one fast but less accurate. Example on Linux:
Python uses CLOCK_REALTIME for time.time(), the most precise one. So it's consistent to use the most accurate clock for time.time() on Windows as well. If tomorrow, performance becomes an issue, we can add a new |
Impressive! Finally Windows will be as good as other platforms here. |
| #endif | ||
|
|
||
|
|
||
| #ifdef MS_WINDOWS |
There was a problem hiding this comment.
Yes, I think checking for MS_WINDOWS here is sufficient. GetSystemTimePreciseAsFileTime(), QueryPerformanceCounter(), and QueryPerformanceFrequency() are available in the system, app, and game partitions. The old use of GetSystemTimeAdjustment() actually wasn't supported for app builds. However, that function was used improperly anyway.
Closes dask#8641. _WindowsTime is no longer needed on Windows with Python 3.13. On Windows, Python 3.13 now uses GetSystemTimePreciseAsFileTime() for time.time() and QueryPerformanceCounter() for time.monotonic(). * python/cpython#116781 * python/cpython#116822
Closes #8641. _WindowsTime is no longer needed on Windows with Python 3.13. On Windows, Python 3.13 now uses GetSystemTimePreciseAsFileTime() for time.time() and QueryPerformanceCounter() for time.monotonic(). * python/cpython#116781 * python/cpython#116822
pythonGH-136068) (cherry picked from commit 486587d) Co-authored-by: Stan Ulbrych <[email protected]>
pythonGH-136068) (cherry picked from commit 486587d) Co-authored-by: Stan Ulbrych <[email protected]>
📚 Documentation preview 📚: https://cpython-previews--116822.org.readthedocs.build/