summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorJakub KulĂ­k <Kulikjak@gmail.com>2020-11-02 23:10:01 (GMT)
committerGitHub <noreply@github.com>2020-11-02 23:10:01 (GMT)
commit9568622c9983b682b2a2a7bacfd3c341028ea099 (patch)
tree9fc4594706a28840f31e48744aada7a01f86113a /Modules
parent45df61fd2d58e8db33179f3b5d00e53fe6a7e592 (diff)
downloadcpython-9568622c9983b682b2a2a7bacfd3c341028ea099.zip
cpython-9568622c9983b682b2a2a7bacfd3c341028ea099.tar.gz
cpython-9568622c9983b682b2a2a7bacfd3c341028ea099.tar.bz2
bpo-35455: Fix thread_time for Solaris OS (GH-11118)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/timemodule.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 8a4d149..eb192c5 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -1371,6 +1371,23 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)
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)
#define HAVE_THREAD_TIME
static int