Issue #23517: datetime.timedelta constructor now rounds microseconds to nearest

with ties going away from zero (ROUND_HALF_UP), as Python 2 and Python older
than 3.3, instead of rounding to nearest with ties going to nearest even
integer (ROUND_HALF_EVEN).
This commit is contained in:
Victor Stinner 2015-09-02 19:16:07 +02:00
parent 8cbb013553
commit 2ec558739e
6 changed files with 26 additions and 34 deletions

View file

@ -44,6 +44,10 @@ PyAPI_FUNC(PyObject *) _PyLong_FromTime_t(
PyAPI_FUNC(time_t) _PyLong_AsTime_t(
PyObject *obj);
/* Round to nearest with ties going away from zero (_PyTime_ROUND_HALF_UP). */
PyAPI_FUNC(double) _PyTime_RoundHalfUp(
double x);
/* Convert a number of seconds, int or float, to time_t. */
PyAPI_FUNC(int) _PyTime_ObjectToTime_t(
PyObject *obj,