Issue #22117: Fix rounding and implement _PyTime_ROUND_FLOOR in:

- _PyTime_ObjectToTime_t()
- _PyTime_ObjectToTimespec()
- _PyTime_ObjectToTimeval()
This commit is contained in:
Victor Stinner 2015-03-30 00:44:06 +02:00
parent 1bd18ba9a7
commit f81f0f9c63
2 changed files with 22 additions and 26 deletions

View file

@ -647,13 +647,13 @@ class TestPytime(unittest.TestCase):
(1e-9, (0, 1), _PyTime.ROUND_DOWN),
(1e-10, (0, 0), _PyTime.ROUND_DOWN),
(-1e-9, (-1, 999999999), _PyTime.ROUND_DOWN),
(-1e-10, (-1, 999999999), _PyTime.ROUND_DOWN),
(-1e-10, (0, 0), _PyTime.ROUND_DOWN),
(-1.2, (-2, 800000000), _PyTime.ROUND_DOWN),
(0.9999999999, (0, 999999999), _PyTime.ROUND_DOWN),
(1.1234567890, (1, 123456789), _PyTime.ROUND_DOWN),
(1.1234567899, (1, 123456789), _PyTime.ROUND_DOWN),
(-1.1234567890, (-2, 876543211), _PyTime.ROUND_DOWN),
(-1.1234567891, (-2, 876543210), _PyTime.ROUND_DOWN),
(-1.1234567891, (-2, 876543211), _PyTime.ROUND_DOWN),
# Round away from zero
(0, (0, 0), _PyTime.ROUND_UP),
(-1, (-1, 0), _PyTime.ROUND_UP),