summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS.d/next/macOS/2018-10-18-23-54-55.bpo-35025.X4LFJg.rst2
-rw-r--r--Modules/timemodule.c4
2 files changed, 6 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/macOS/2018-10-18-23-54-55.bpo-35025.X4LFJg.rst b/Misc/NEWS.d/next/macOS/2018-10-18-23-54-55.bpo-35025.X4LFJg.rst
new file mode 100644
index 0000000..aebd1af
--- /dev/null
+++ b/Misc/NEWS.d/next/macOS/2018-10-18-23-54-55.bpo-35025.X4LFJg.rst
@@ -0,0 +1,2 @@
+Properly guard the use of the ``CLOCK_GETTIME`` et al. macros in ``timemodule``
+on macOS.
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index f41d6fa..01eb9f6 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -1723,6 +1723,8 @@ PyInit_time(void)
/* Set, or reset, module variables like time.timezone */
PyInit_timezone(m);
+#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_SETTIME) || defined(HAVE_CLOCK_GETRES)
+
#ifdef CLOCK_REALTIME
PyModule_AddIntMacro(m, CLOCK_REALTIME);
#endif
@@ -1751,6 +1753,8 @@ PyInit_time(void)
PyModule_AddIntMacro(m, CLOCK_UPTIME);
#endif
+#endif /* defined(HAVE_CLOCK_GETTIME) || defined(HAVE_CLOCK_SETTIME) || defined(HAVE_CLOCK_GETRES) */
+
if (!initialized) {
if (PyStructSequence_InitType2(&StructTimeType,
&struct_time_type_desc) < 0)