mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Issue #14368: _PyTime_gettimeofday() cannot fail
floattime() must not raise an error if the current time is 1970.1.1 at 00:00.
This commit is contained in:
parent
a5cf6c4913
commit
70b2e1e7d9
1 changed files with 1 additions and 7 deletions
|
@ -1063,14 +1063,8 @@ static PyObject*
|
||||||
floattime(void)
|
floattime(void)
|
||||||
{
|
{
|
||||||
_PyTime_timeval t;
|
_PyTime_timeval t;
|
||||||
double secs;
|
|
||||||
_PyTime_gettimeofday(&t);
|
_PyTime_gettimeofday(&t);
|
||||||
secs = (double)t.tv_sec + t.tv_usec*0.000001;
|
return PyFloat_FromDouble((double)t.tv_sec + t.tv_usec * 1e-6);
|
||||||
if (secs == 0.0) {
|
|
||||||
PyErr_SetFromErrno(PyExc_OSError);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return PyFloat_FromDouble(secs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue