mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
Issue #23517: fromtimestamp() and utcfromtimestamp() methods of
datetime.datetime now round microseconds to nearest with ties going away from zero (ROUND_HALF_UP), as Python 2 and Python older than 3.3, instead of rounding towards -Infinity (ROUND_FLOOR).
This commit is contained in:
parent
0fa5ef72b7
commit
2ec5bd6fb2
4 changed files with 14 additions and 8 deletions
|
@ -4078,7 +4078,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