Victor Stinner
511491ade0
Issue #23517 : Fix rounding in fromtimestamp() and utcfromtimestamp() methods
...
of datetime.datetime: microseconds are now rounded to nearest with ties going
to nearest even integer (ROUND_HALF_EVEN), instead of being rounding towards
zero (ROUND_DOWN). It's important that these methods use the same rounding
mode than datetime.timedelta to keep the property:
(datetime(1970,1,1) + timedelta(seconds=t)) == datetime.utcfromtimestamp(t)
It also the rounding mode used by round(float) for example.
Add more unit tests on the rounding mode in test_datetime.
2015-09-18 14:42:05 +02:00
..
2015-08-14 15:30:59 -04:00
2015-09-08 00:36:29 -04:00
2015-07-29 14:33:52 +02:00
2015-04-10 13:24:41 +03:00
2015-09-12 17:20:47 -07:00
2015-08-01 08:18:22 +12:00
2015-09-12 00:34:28 +00:00
2015-08-24 16:13:48 -04:00
2015-09-06 21:38:06 +03:00
2015-08-17 12:18:35 +12:00
2015-09-09 02:10:17 -04:00
2014-12-01 17:10:10 -05:00
2015-07-05 11:45:01 -07:00
2015-05-13 13:39:51 +03:00
2015-04-10 13:24:41 +03:00
2015-04-10 13:24:41 +03:00
2015-02-22 23:54:38 -08:00
2015-05-22 11:02:49 +03:00
2015-09-18 14:42:05 +02:00
2015-06-21 14:41:44 +03:00
2015-02-22 17:25:33 +02:00
2015-09-12 17:45:25 +03:00
2015-08-04 12:52:06 +12:00
2015-02-06 11:23:58 -05:00
2015-07-27 10:42:01 +12:00
2015-05-06 09:36:06 +03:00
2015-04-10 13:24:41 +03:00
2015-01-26 09:57:07 +02:00
2015-03-31 16:49:26 +03:00
2015-04-13 20:01:21 +02:00
2015-03-19 19:13:37 +02:00
2015-07-10 22:13:40 +03:00
2014-10-20 08:36:02 +02:00
2015-04-03 18:12:41 +03:00
2015-04-10 13:24:41 +03:00
2015-03-11 17:18:03 +02:00
2015-08-18 10:21:10 -07:00
2015-07-10 22:24:47 +03:00
2015-07-30 18:26:10 +03:00
2015-08-14 11:11:35 +12:00
2015-06-28 17:06:07 +03:00
2015-09-18 14:42:05 +02:00
2015-03-12 21:56:08 +02:00
2015-01-26 09:57:07 +02:00
2015-03-18 18:19:30 -07:00
2015-04-10 13:24:41 +03:00
2015-01-05 09:19:40 +02:00
2015-04-10 13:24:41 +03:00
2015-08-18 14:30:15 -04:00
2015-04-13 10:38:56 -04:00
2015-04-10 13:24:41 +03:00
2014-12-01 18:28:43 +02:00
2015-07-31 08:59:02 +12:00
2015-04-14 15:43:00 -05:00
2015-07-18 23:19:05 +03:00
2015-01-26 10:11:16 +02:00
2015-04-01 16:54:05 +03:00
2014-10-02 10:49:26 +03:00
2014-09-27 18:53:23 +03:00
2015-04-10 13:24:41 +03:00
2015-03-10 13:17:21 -07:00
2015-03-21 09:40:26 +02:00
2015-03-25 16:40:15 +02:00
2015-01-26 09:57:07 +02:00
2015-04-13 20:24:10 -04:00
2015-02-15 18:03:59 +01:00
2015-09-05 19:13:26 -04:00
2015-03-31 13:12:37 +03:00
2014-12-16 18:00:56 +02:00
2015-04-10 13:24:41 +03:00
2014-12-20 20:57:15 +02:00
2015-04-14 18:57:55 +03:00
2015-04-21 21:09:48 +03:00
2015-03-20 16:46:19 +02:00
2014-11-30 11:49:00 -05:00
2015-07-28 00:06:31 +03:00
2015-04-10 13:24:41 +03:00
2015-04-10 13:24:41 +03:00
2014-10-17 20:28:47 -04:00
2015-09-08 05:47:23 +03:00
2015-02-01 20:17:22 -05:00
2015-04-07 11:59:06 -04:00
2015-04-10 13:24:41 +03:00
2015-03-18 18:19:30 -07:00
2015-02-03 11:55:09 +02:00
2014-11-10 13:24:47 +02:00
2015-02-21 12:08:52 +02:00
2015-03-04 23:18:57 -05:00
2015-03-24 22:28:43 +02:00
2015-02-28 12:43:08 +02:00
2015-07-10 22:13:40 +03:00
2015-07-06 09:27:24 +02:00
2015-04-10 13:24:41 +03:00
2015-05-20 00:11:48 +03:00
2015-04-03 18:12:41 +03:00
2014-10-04 17:43:54 -04:00
2015-05-30 19:38:26 +03:00
2015-06-22 10:01:12 +08:00
2015-02-22 17:25:33 +02:00
2015-03-04 09:43:27 +02:00
2014-11-21 21:55:39 +02:00
2014-12-14 10:53:00 +02:00
2015-07-10 22:13:40 +03:00
2014-10-05 20:02:28 +02:00
2014-10-10 21:21:52 +03:00
2015-01-26 13:45:39 +02:00