8000 bpo-40017: add CLOCK_TAI constant to the time module, if the constant is defined by r-owen · Pull Request #19096 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-40017: add CLOCK_TAI constant to the time module, if the constant is defined #19096

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
Mar 24, 2020
11 changes: 10 additions & 1 deletion Doc/library/time.rst
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,16 @@ These constants are used as parameters for :func:`clock_getres` and

.. versionadded:: 3.7

.. data:: CLOCK_TAI

`International Atomic Time <https://www.nist.gov/pml/time-and-frequency-division/nist-time-frequently-asked-questions-faq#tai>`_

The system must have a current leap second table in order for this to give
the correct answer. PTP or NTP software can maintain a leap second table.

.. availability:: Linux.

.. versionadded:: 3.9

.. data:: CLOCK_THREAD_CPUTIME_ID

Expand Down Expand Up @@ -805,7 +815,6 @@ These constants are used as parameters for :func:`clock_getres` and

.. versionadded:: 3.8


Copy link
Member

Choose a reason for hiding this comment

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

I like having two empty lines, it helps readibility. Please keep it ;-)

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add :data:`time.CLOCK_TAI` constant if the operating system support it.
5 changes: 5 additions & 0 deletions Modules/timemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,11 @@ time_exec(PyObject *module)
return -1;
}
#endif
#ifdef CLOCK_TAI
if (PyModule_AddIntMacro(module, CLOCK_TAI) < 0) {
return -1;
}
#endif
#ifdef CLOCK_UPTIME
if (PyModule_AddIntMacro(module, CLOCK_UPTIME) < 0) {
return -1;
Expand Down
0