diff options
author | haney <david.haney@gmail.com> | 2017-06-21 18:18:21 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2017-06-21 18:18:21 (GMT) |
commit | c90e96015085784df86632b26059b19c80cbfc97 (patch) | |
tree | ce3e0ce6d48835c5ff21dd493a6ee26ac561bb47 /Python | |
parent | dcc8ce44c74492670e6bfbde588a2acbf8f365e0 (diff) | |
download | cpython-c90e96015085784df86632b26059b19c80cbfc97.zip cpython-c90e96015085784df86632b26059b19c80cbfc97.tar.gz cpython-c90e96015085784df86632b26059b19c80cbfc97.tar.bz2 |
bpo-30183: Fixes HP-UX cc compilation error in pytime.c (#1351)
* 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()'.
* bpo-30183: Removes unnecessary return
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pytime.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Python/pytime.c b/Python/pytime.c index 3015a6b..8979adc 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -693,6 +693,26 @@ 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; + } + + *tp = time; + + if (info) { + info->implementation = "gethrtime()"; + info->resolution = 1e-9; + info->monotonic = 1; + info->adjustable = 0; + } + #else struct timespec ts; #ifdef CLOCK_HIGHRES |