summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-08-29 14:31:59 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-08-29 14:31:59 (GMT)
commit0011124dc235fb9af1a80acf3df7edd8816c0a9d (patch)
treeb4c63644aa1fecc1a3ad188da1a73a9f2812c380 /Modules
parent7efb83393cbe08924682c6852e94d3c4a4033c34 (diff)
downloadcpython-0011124dc235fb9af1a80acf3df7edd8816c0a9d.zip
cpython-0011124dc235fb9af1a80acf3df7edd8816c0a9d.tar.gz
cpython-0011124dc235fb9af1a80acf3df7edd8816c0a9d.tar.bz2
Issue #22043: _PyTime_Init() now checks if the system clock works.
Other changes: * The whole _PyTime API is private (not defined if Py_LIMITED_API is set) * _PyTime_gettimeofday_info() also returns -1 on error * Simplify PyTime_gettimeofday(): only use clock_gettime(CLOCK_REALTIME) or gettimeofday() on UNIX. Don't fallback to ftime() or time() anymore.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/timemodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 2b2b4bd..1a13fd0e 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -1535,7 +1535,10 @@ static PyObject*
floattime(_Py_clock_info_t *info)
{
_PyTime_timeval t;
- _PyTime_gettimeofday_info(&t, info);
+ if (_PyTime_gettimeofday_info(&t, info) < 0) {
+ assert(info != NULL);
+ return NULL;
+ }
return PyFloat_FromDouble((double)t.tv_sec + t.tv_usec * 1e-6);
}