From: Russell Owen Date: Tue, 24 Mar 2020 03:41:40 +0000 (-0700) Subject: closes bpo-40017: Add CLOCK_TAI constant to the time module. (GH-19096) X-Git-Tag: v3.9.0a6~292 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6000087fe979705dc588a46a35da884cc0198c67;p=thirdparty%2FPython%2Fcpython.git closes bpo-40017: Add CLOCK_TAI constant to the time module. (GH-19096) Co-authored-by: Benjamin Peterson --- diff --git a/Doc/library/time.rst b/Doc/library/time.rst index 6842e9075e1a..cff6320b526d 100644 --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -774,6 +774,16 @@ These constants are used as parameters for :func:`clock_getres` and .. versionadded:: 3.7 +.. data:: CLOCK_TAI + + `International Atomic Time `_ + + 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 @@ -805,7 +815,6 @@ These constants are used as parameters for :func:`clock_getres` and .. versionadded:: 3.8 - The following constant is the only parameter that can be sent to :func:`clock_settime`. diff --git a/Misc/NEWS.d/next/Library/2020-03-21-00-46-18.bpo-40017.HFpHZS.rst b/Misc/NEWS.d/next/Library/2020-03-21-00-46-18.bpo-40017.HFpHZS.rst new file mode 100644 index 000000000000..9a17272d9699 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-03-21-00-46-18.bpo-40017.HFpHZS.rst @@ -0,0 +1 @@ +Add :data:`time.CLOCK_TAI` constant if the operating system support it. diff --git a/Modules/timemodule.c b/Modules/timemodule.c index f458966e290b..e269cd047fb4 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -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;