Skip to content

Commit c90e960

Browse files
haneyvstinner
authored andcommitted
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
1 parent dcc8ce4 commit c90e960

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Python/pytime.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,26 @@ pymonotonic(_PyTime_t *tp, _Py_clock_info_t *info, int raise)
693693
info->adjustable = 0;
694694
}
695695

696+
#elif defined(__hpux)
697+
hrtime_t time;
698+
699+
time = gethrtime();
700+
if (time == -1) {
701+
if (raise) {
702+
PyErr_SetFromErrno(PyExc_OSError);
703+
}
704+
return -1;
705+
}
706+
707+
*tp = time;
708+
709+
if (info) {
710+
info->implementation = "gethrtime()";
711+
info->resolution = 1e-9;
712+
info->monotonic = 1;
713+
info->adjustable = 0;
714+
}
715+
696716
#else
697717
struct timespec ts;
698718
#ifdef CLOCK_HIGHRES

0 commit comments

Comments
 (0)