8000 closes bpo-40017: Add CLOCK_TAI constant to the time module. (GH-19096) · python/cpython@6000087 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6000087

Browse files
r-owenbenjaminp
andauthored
closes bpo-40017: Add CLOCK_TAI constant to the time module. (GH-19096)
Co-authored-by: Benjamin Peterson <benjamin@python.org>
1 parent 70d9d74 commit 6000087

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

Doc/library/time.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,16 @@ These constants are used as parameters for :func:`clock_getres` and
774774

775775
.. versionadded:: 3.7
776776

777+
.. data:: CLOCK_TAI
778+
779+
`International Atomic Time <https://www.nist.gov/pml/time-and-frequency-division/nist-time-frequently-asked-questions-faq#tai>`_
780+
781+
The system must have a current leap second table in order for this to give
782+
the correct answer. PTP or NTP software can maintain a leap second table.
783+
784+
.. availability:: Linux.
785+
786+
.. versionadded:: 3.9
777787

778788
.. data:: CLOCK_THREAD_CPUTIME_ID
779789

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

806816
.. versionadded:: 3.8
807817

808-
809818
The following constant is the only parameter that can be sent to
810819
:func:`clock_settime`.
811820

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add :data:`time.CLOCK_TAI` constant if the operating system support it.

Modules/timemodule.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,6 +1786,11 @@ time_exec(PyObject *module)
17861786
return -1;
17871787
}
17881788
#endif
1789+
#ifdef CLOCK_TAI
1790+
if (PyModule_AddIntMacro(module, CLOCK_TAI) < 0) {
1791+
return -1;
1792+
}
1793+
#endif
17891794
#ifdef CLOCK_UPTIME
17901795
if (PyModule_AddIntMacro(module, CLOCK_UPTIME) < 0) {
17911796
return -1;

0 commit comments

Comments
 (0)
0