From af40a06d836199705c20ac8752c70042432b2eef Mon Sep 17 00:00:00 2001 From: David Haney Date: Wed, 26 Apr 2017 21:46:15 -0700 Subject: [PATCH 1/2] bpo-30183: Fixes HP-UX cc compilation error in pytime.c HP-UX does not support the CLOCK_MONOTONIC identifier, and will fail to compile: "Python/pytime.c", line 723: error #2020: identifier "CLOCK_MONOTONIC" is undefined const clockid_t clk_id = CLOCK_MONOTONIC; Add a new section for __hpux that calls 'gethrtime()' instead of 'clock_gettime()'. --- Python/pytime.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Python/pytime.c b/Python/pytime.c index 3015a6be0b83c1..339a3ab04aa781 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -693,6 +693,27 @@ pymonotonic(_PyTime_t *tp, _Py_clock_info_t *info, int raise) info->adjustable = 0; } +#elif defined(__hpux) + hrtime_t time; + + time = gethrtime(); + if (time == -1) { + if (raise) { + PyErr_SetFromErrno(PyExc_OSError); + return -1; + } + return -1; + } + + *tp = time; + + if (info) { + info->implementation = "gethrtime()"; + info->resolution = 1e-9; + info->monotonic = 1; + info->adjustable = 0; + } + #else struct timespec ts; #ifdef CLOCK_HIGHRES From e0caad1561e3cc0c4ec6a8c8823dcffd7e038e31 Mon Sep 17 00:00:00 2001 From: David Haney Date: Wed, 21 Jun 2017 09:46:19 -0700 Subject: [PATCH 2/2] bpo-30183: Removes unnecessary return --- Python/pytime.c | 1 - 1 file changed, 1 deletion(-) diff --git a/Python/pytime.c b/Python/pytime.c index 339a3ab04aa781..8979adc2191267 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -700,7 +700,6 @@ pymonotonic(_PyTime_t *tp, _Py_clock_info_t *info, int raise) if (time == -1) { if (raise) { PyErr_SetFromErrno(PyExc_OSError); - return -1; } return -1; }