mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
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:
parent
744742320f
commit
265e1259e4
2 changed files with 6 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue