8000 gh-126745: Fixup Docu time.rst by dbstf · Pull Request #126744 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-126745: Fixup Docu time.rst #126744

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

Closed
wants to merge 2 commits into from
Closed

gh-126745: Fixup Docu time.rst #126744

wants to merge 2 commits into from

Conversation

dbstf
Copy link
@dbstf dbstf commented Nov 12, 2024
  • On Windows, the .time function now uses GetSystemTimePreciseAsFileTime() [--> 1 microsecond resolution] instead of GetSystemTimeAsFileTime() [--> 15.625 millisecond resolution].
  • On Windows The .monotonic functions now use the same clock as the .perf_counter functions, not vice versa. The .perf_counter functions previously already used QueryPerformanceCounter() + QueryPerformanceFrequency() [--> 1 microsecond resolution], whereas the .monotonic functions used GetTickCount64() [--> 15.625 millisecond resolution].

📚 Documentation preview 📚: https://cpython-previews--126744.org.readthedocs.build/

- On Windows, the .time function now uses GetSystemTimePreciseAsFileTime() [--> 1 microsecond resolution] instead of GetSystemTimeAsFileTime() [--> 15.625 millisecond resolution].
- On Windows The .monotonic functions now use the same clock as the .perf_counter functions, not vice versa. The .perf_counter functions previously already used QueryPerformanceCounter() + QueryPerformanceFrequency() [--> 1 microsecond resolution], whereas the .monotonic functions used GetTickCount64() [--> 15.625 millisecond resolution].
@ghost
Copy link
ghost commented Nov 12, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app bedevere-app bot added docs Documentation in the Doc dir skip news awaiting review labels Nov 12, 2024
@dbstf dbstf changed the title Fixup Docu time.rst gh-126745: Fixup Docu time.rst Nov 12, 2024
@picnixz picnixz added the needs backport to 3.13 bugs and security fixes label Nov 12, 2024
.. impl-detail::

On CPython, use the same clock as :func:`time.perf_counter` and is a
monotonic clock, i.e. a clock that cannot go backwards.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes more sense under perf_counter were it was. All monotonic function should always be monotonic, by definition.

@@ -307,13 +312,21 @@ Functions
.. versionchanged:: 3.10
On macOS, the function is now system-wide.

.. versionchanged:: 3.13
Use the same clock as :func:`time.perf_counter`. On Windows, :func:`monotonic`

This comment was marked as resolved.

Comment on lines +316 to +317
Use the same clock as :func:`time.perf_counter`. On Windows, :func:`monotonic`
now call ``QueryPerformanceCounter()`` which has a resolution of 1 microsecond,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Use the same clock as :func:`time.perf_counter`. On Windows, :func:`monotonic`
now call ``QueryPerformanceCounter()`` which has a resolution of 1 microsecond,
Use the same clock as :func:`time.perf_counter`. On Windows, :func:`monotonic`
now calls ``QueryPerformanceCounter()`` which has a resolution of 1 microsecond,

* Call ``clock_gettime(CLOCK_REALTIME)`` if available.
* Otherwise, call ``gettimeofday()``.

Use :func:`time_ns` to avoid the precision loss caused by the :class:`float`
type.

.. versionchanged:: 3.13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. versionchanged:: 3.13
.. versionchanged:: 3.13

Suspect the mixed indentation is screwing it up

@@ -307,13 +312,21 @@ Functions
.. versionchanged:: 3.10
On macOS, the function is now system-wide.

.. versionchanged:: 3.13
Use the same clock as :func:`time.perf_counter`. On Windows, :func:`monotonic`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Use the same clock as :func:`time.perf_counter`. On Windows, :func:`monotonic`
The function now uses the same clock as :func:`time.perf_counter`. On Windows, :func:`monotonic`

@dbstf dbstf closed this by deleting the head repository Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review docs Documentation in the Doc dir needs backport to 3.13 bugs and security fixes skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

3 participants
0