diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2012-03-26 20:08:02 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2012-03-26 20:08:02 (GMT) |
commit | 70b2e1e7d99431cf71c8177dcf42dba03435177e (patch) | |
tree | e5d71a94af55a7b67b250d468bd61c9180cdaf8b | |
parent | a5cf6c4913980e27f6868d22929e63e5be22e3dc (diff) | |
download | cpython-70b2e1e7d99431cf71c8177dcf42dba03435177e.zip cpython-70b2e1e7d99431cf71c8177dcf42dba03435177e.tar.gz cpython-70b2e1e7d99431cf71c8177dcf42dba03435177e.tar.bz2 |
Issue #14368: _PyTime_gettimeofday() cannot fail
floattime() must not raise an error if the current time is 1970.1.1 at 00:00.
-rw-r--r-- | Modules/timemodule.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index e6e1ff4..1d84db1 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); } |