]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
closes bpo-40017: Add CLOCK_TAI constant to the time module. (GH-19096)
authorRussell Owen <rowen@uw.edu>
Tue, 24 Mar 2020 03:41:40 +0000 (20:41 -0700)
committerGitHub <noreply@github.com>
Tue, 24 Mar 2020 03:41:40 +0000 (22:41 -0500)
Co-authored-by: Benjamin Peterson <benjamin@python.org>
Doc/library/time.rst
Misc/NEWS.d/next/Library/2020-03-21-00-46-18.bpo-40017.HFpHZS.rst [new file with mode: 0644]
Modules/timemodule.c

index 6842e9075e1a682fbc014cb0959d4b463d7a3f68..cff6320b526db5601d1d3e36bdd16569d6f9b9a2 100644 (file)
@@ -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
 
@@ -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 (file)
index 0000000..9a17272
--- /dev/null
@@ -0,0 +1 @@
+Add :data:`time.CLOCK_TAI` constant if the operating system support it.
index f458966e290bb9c68a084bad20a8a4be3028d0b2..e269cd047fb434a4c27f3e2d56cb3f050c6c170e 100644 (file)
@@ -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;