Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a549ab5

Browse files
committed
dates._from_ordinalf: Use normal rounding for microseconds
1 parent 74889a1 commit a549ab5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/dates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ def _from_ordinalf(x, tz=None):
286286

287287
remainder = float(x) - ix
288288

289-
# Round down to the nearest microsecond.
290-
dt += datetime.timedelta(microseconds=int(remainder * MUSECONDS_PER_DAY))
289+
# Round to the nearest microsecond.
290+
dt += datetime.timedelta(microseconds=int(round(remainder * MUSECONDS_PER_DAY)))
291291

292292
# Compensate for rounding errors
293293
if dt.microsecond < 10:

0 commit comments

Comments
 (0)