mirror of https://github.com/python/cpython
bpo-35455: Fix thread_time for Solaris OS (GH-11118)
This commit is contained in:
parent
45df61fd2d
commit
9568622c99
|
@ -0,0 +1,3 @@
|
||||||
|
On Solaris, :func:`~time.thread_time` is now implemented with
|
||||||
|
``gethrvtime()`` because ``clock_gettime(CLOCK_THREAD_CPUTIME_ID)`` is not
|
||||||
|
always available. Patch by Jakub Kulik.
|
|
@ -1371,6 +1371,23 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#elif defined(__sun) && defined(__SVR4)
|
||||||
|
#define HAVE_THREAD_TIME
|
||||||
|
static int
|
||||||
|
_PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)
|
||||||
|
{
|
||||||
|
/* bpo-35455: On Solaris, CLOCK_THREAD_CPUTIME_ID clock is not always
|
||||||
|
available; use gethrvtime() to substitute this functionality. */
|
||||||
|
if (info) {
|
||||||
|
info->implementation = "gethrvtime()";
|
||||||
|
info->resolution = 1e-9;
|
||||||
|
info->monotonic = 1;
|
||||||
|
info->adjustable = 0;
|
||||||
|
}
|
||||||
|
*tp = _PyTime_FromNanoseconds(gethrvtime());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID)
|
#elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID)
|
||||||
#define HAVE_THREAD_TIME
|
#define HAVE_THREAD_TIME
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in New Issue