From: Victor Stinner Date: Mon, 26 Mar 2012 20:08:02 +0000 (+0200) Subject: Issue #14368: _PyTime_gettimeofday() cannot fail X-Git-Tag: v3.3.0a2~41 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=70b2e1e7d99431cf71c8177dcf42dba03435177e;p=thirdparty%2FPython%2Fcpython.git Issue #14368: _PyTime_gettimeofday() cannot fail floattime() must not raise an error if the current time is 1970.1.1 at 00:00. --- diff --git a/Modules/timemodule.c b/Modules/timemodule.c index e6e1ff400ef9..1d84db1d9d0a 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -1063,14 +1063,8 @@ static PyObject* floattime(void) { _PyTime_timeval t; - double secs; _PyTime_gettimeofday(&t); - secs = (double)t.tv_sec + t.tv_usec*0.000001; - if (secs == 0.0) { - PyErr_SetFromErrno(PyExc_OSError); - return NULL; - } - return PyFloat_FromDouble(secs); + return PyFloat_FromDouble((double)t.tv_sec + t.tv_usec * 1e-6); }