summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-08-29 13:41:08 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-08-29 13:41:08 (GMT)
commit7efb83393cbe08924682c6852e94d3c4a4033c34 (patch)
treeb8ac264faa3d2470659df159932d27adcf9cd9ce /Modules
parent0dc10e0d1c96c39602ae08403ed758fa72b6d547 (diff)
downloadcpython-7efb83393cbe08924682c6852e94d3c4a4033c34.zip
cpython-7efb83393cbe08924682c6852e94d3c4a4033c34.tar.gz
cpython-7efb83393cbe08924682c6852e94d3c4a4033c34.tar.bz2
Issue #22287: On UNIX, _PyTime_gettimeofday() now uses
clock_gettime(CLOCK_REALTIME) if available. As a side effect, Python now depends on the librt library on Solaris and on Linux (only with glibc older than 2.17).
Diffstat (limited to 'Modules')
-rw-r--r--Modules/timemodule.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index d896091..2b2b4bd 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -1535,28 +1535,6 @@ static PyObject*
floattime(_Py_clock_info_t *info)
{
_PyTime_timeval t;
-#ifdef HAVE_CLOCK_GETTIME
- struct timespec tp;
- int ret;
-
- /* _PyTime_gettimeofday() does not use clock_gettime()
- because it would require to link Python to the rt (real-time)
- library, at least on Linux */
- ret = clock_gettime(CLOCK_REALTIME, &tp);
- if (ret == 0) {
- if (info) {
- struct timespec res;
- info->implementation = "clock_gettime(CLOCK_REALTIME)";
- info->monotonic = 0;
- info->adjustable = 1;
- if (clock_getres(CLOCK_REALTIME, &res) == 0)
- info->resolution = res.tv_sec + res.tv_nsec * 1e-9;
- else
- info->resolution = 1e-9;
- }
- return PyFloat_FromDouble(tp.tv_sec + tp.tv_nsec * 1e-9);
- }
-#endif
_PyTime_gettimeofday_info(&t, info);
return PyFloat_FromDouble((double)t.tv_sec + t.tv_usec * 1e-6);
}