Issue #23517: datetime.datetime.fromtimestamp() and

datetime.datetime.utcfromtimestamp() now rounds to nearest with ties going away
from zero, instead of rounding towards minus infinity (-inf), as Python 2 and
Python older than 3.3.
This commit is contained in:
Victor Stinner 2015-09-02 01:57:23 +02:00
parent 744742320f
commit 265e1259e4
2 changed files with 6 additions and 1 deletions

View file

@ -4098,7 +4098,7 @@ datetime_from_timestamp(PyObject *cls, TM_FUNC f, PyObject *timestamp,
long us;
if (_PyTime_ObjectToTimeval(timestamp,
&timet, &us, _PyTime_ROUND_FLOOR) == -1)
&timet, &us, _PyTime_ROUND_HALF_UP) == -1)
return NULL;
return datetime_from_timet_and_us(cls, f, timet, (int)us, tzinfo);