Skip to content

bpo-35702: Add new identifier CLOCK_UPTIME_RAW for Darwin #11503

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

Merged
merged 11 commits into from
Jan 10, 2019
Merged
12 changes: 12 additions & 0 deletions Doc/library/time.rst
Original file line number Diff line number Diff line change
Expand Up @@ -815,9 +815,21 @@ These constants are used as parameters for :func:`clock_getres` and
.. versionadded:: 3.7


.. data:: CLOCK_UPTIME_RAW

Clock that increments monotonically, tracking the time since an arbitrary
point, unaffected by frequency or time adjustments and not incremented while
the system is asleep.
Copy link
Member

Choose a reason for hiding this comment

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

LGTM. FYI http://www.manpagez.com/man/3/clock_gettime/ has a different definition:

 CLOCK_UPTIME_RAW   clock that increments monotonically, in the same man-
                    ner as CLOCK_MONOTONIC_RAW, but that does not incre-
                    ment while the system is asleep.  The returned value
                    is identical to the result of mach_absolute_time()
                    after the appropriate mach_timebase conversion is
                    applied.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm... is the current short version better or we use the description in the man page?

Copy link
Member

Choose a reason for hiding this comment

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

The short version is fine. The longer version doesn't add anything useful and is too low-level.


.. availability:: macOS 10.12 and newer.

.. versionadded:: 3.8


The following constant is the only parameter that can be sent to
:func:`clock_settime`.


.. data:: CLOCK_REALTIME

System-wide real-time clock. Setting this clock requires appropriate
Expand Down
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ Added method :meth:`~tkinter.Canvas.moveto`
in the :class:`tkinter.Canvas` class.
(Contributed by Juliette Monsel in :issue:`23831`.)

time
----

Added new clock :data:`~time.CLOCK_UPTIME_RAW` for macOS 10.12.
(Contributed by Joannah Nanjekye in :issue:`35702`.)

unicodedata
-----------

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The :data:`time.CLOCK_UPTIME_RAW` constant is now available for macOS 10.12.
3 changes: 3 additions & 0 deletions Modules/timemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1806,6 +1806,9 @@ PyInit_time(void)
#ifdef CLOCK_UPTIME
PyModule_AddIntMacro(m, CLOCK_UPTIME);
#endif
#ifdef CLOCK_UPTIME_RAW
PyModule_AddIntMacro(m, CLOCK_UPTIME_RAW);
#endif

#endif /* defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_SETTIME) || defined(HAVE_CLOCK_GETRES) */

Expand Down