[Python-checkins] cpython: Issue #14368: _PyTime_gettimeofday() cannot fail
victor.stinner
python-checkins at python.org
Mon Mar 26 22:08:41 CEST 2012
http://hg.python.org/cpython/rev/206c45f45236
changeset: 75958:206c45f45236
user: Victor Stinner <victor.stinner at gmail.com>
date: Mon Mar 26 22:08:02 2012 +0200
summary:
Issue #14368: _PyTime_gettimeofday() cannot fail
floattime() must not raise an error if the current time is 1970.1.1 at 00:00.
files:
Modules/timemodule.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -1063,14 +1063,8 @@
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);
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list