Victor Stinner
717a32b755
Fix typo in test_time.py
2016-08-17 11:07:21 +02:00
Victor Stinner
c60542b12b
pytime: add _PyTime_check_mul_overflow() macro to avoid undefined behaviour
...
Overflow test in test_FromSecondsObject() fails on FreeBSD 10.0 buildbot which
uses clang. clang implements more aggressive optimization which gives
different result than GCC on undefined behaviours.
Check if a multiplication will overflow, instead of checking if a
multiplicatin had overflowed, to avoid undefined behaviour.
Add also debug information if the test on overflow fails.
2015-09-10 15:55:07 +02:00
Victor Stinner
350b51839a
Fix test_time on platform with 32-bit time_t type
...
Filter also values for check_float_rounding().
2015-09-10 11:45:06 +02:00
Victor Stinner
4237d3474c
Fix test_time on platform with 32-bit time_t type
...
Filter values which would overflow when converted to a C time_t type.
2015-09-10 10:10:39 +02:00
Victor Stinner
9c72f9b30a
Fix test_time on Windows
...
* Filter values which would overflow on conversion to the C long type
(for timeval.tv_sec).
* Adjust also the message of OverflowError on PyTime conversions
* test_time: add debug information if a timestamp conversion fails
2015-09-10 09:10:14 +02:00
Victor Stinner
3e2c8d84c6
test_time: rewrite PyTime API rounding tests
...
Drop all hardcoded tests. Instead, reimplement each function in Python, usually
using decimal.Decimal for the rounding mode.
Add much more values to the dataset. Test various timestamp units from
picroseconds to seconds, in integer and float.
Enhance also _PyTime_AsSecondsDouble().
2015-09-09 22:32:48 +02:00
Victor Stinner
7667f58151
Issue #23517 : fromtimestamp() and utcfromtimestamp() methods of
...
datetime.datetime now round microseconds to nearest with ties going to nearest
even integer (ROUND_HALF_EVEN), as round(float), instead of rounding towards
-Infinity (ROUND_FLOOR).
pytime API: replace _PyTime_ROUND_HALF_UP with _PyTime_ROUND_HALF_EVEN. Fix
also _PyTime_Divide() for negative numbers.
_PyTime_AsTimeval_impl() now reuses _PyTime_Divide() instead of reimplementing
rounding modes.
2015-09-09 01:02:23 +02:00
Steve Dower
45fd95155f
Merge from 3.5
2015-09-06 22:31:26 -07:00
Steve Dower
e5b5895b5b
Issue #24917 : time_strftime() buffer over-read.
2015-09-06 19:20:51 -07:00
Larry Hastings
62b24624dd
Backing out 09b62202d9b7; the tests fail on Linux, and it needs a re-think.
2015-09-06 00:31:02 -07:00
Steve Dower
643d6d3135
Issue #24917 : Backed out changeset 09b62202d9b7
2015-09-05 23:12:18 -07:00
Steve Dower
dcaf4ccf3f
Issue #24917 : Backed out changeset 09b62202d9b7
2015-09-05 23:11:53 -07:00
Steve Dower
74a7b8f027
Issue #24917 : time_strftime() Buffer Over-read. Patch by John Leitch.
2015-09-05 21:00:33 -07:00
Steve Dower
373602fa3f
Issue #24917 : time_strftime() Buffer Over-read. Patch by John Leitch.
2015-09-05 12:16:06 -07:00
Victor Stinner
adfefa527a
Issue #23517 : Fix implementation of the ROUND_HALF_UP rounding mode in
...
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp().
microseconds sign should be kept before rounding.
2015-09-04 23:57:25 +02:00
Victor Stinner
110f9e3538
test_time: add tests on HALF_UP rounding mode for _PyTime_ObjectToTime_t() and
...
_PyTime_ObjectToTimespec()
2015-09-04 10:31:16 +02:00
Victor Stinner
8aad8d6ad3
Issue #23517 : test_time, skip a test checking a corner case on floating point
...
rounding
2015-09-02 13:54:28 +02:00
Victor Stinner
ead144c19b
test_time: add more tests on HALF_UP rounding mode
2015-09-02 11:05:32 +02:00
Victor Stinner
acea9f6208
Issue #23517 : Reintroduce unit tests for the old PyTime API since it's still
...
used.
2015-09-02 10:39:40 +02:00
Victor Stinner
744742320f
Issue #23517 : Add "half up" rounding mode to the _PyTime API
2015-09-02 01:43:56 +02:00
Steve Dower
7aec764d73
Closes #24244 : Removes invalid test from test_time
2015-06-23 20:48:32 -07:00
Victor Stinner
13019fdef3
Issue #22117 : Add a new _PyTime_FromSeconds() function
...
Fix also _Py_InitializeEx_Private(): initialize time before initializing
import, import_init() uses the _PyTime API (for thread locks).
2015-04-03 13:10:54 +02:00
Victor Stinner
62d1c70eff
Issue #22117 , issue #23485 : Fix _PyTime_AsMilliseconds() and
...
_PyTime_AsMicroseconds() rounding.
Add also unit tests.
2015-04-01 17:47:07 +02:00
Victor Stinner
a695f83f0d
Issue #22117 : Remove _PyTime_ROUND_DOWN and _PyTime_ROUND_UP rounding methods
...
Use _PyTime_ROUND_FLOOR and _PyTime_ROUND_CEILING instead.
2015-03-30 03:57:14 +02:00
Victor Stinner
bcdd777d3c
Issue #22117 : Add _PyTime_ROUND_CEILING rounding method for timestamps
...
Add also more tests for ROUNd_FLOOR.
2015-03-30 03:52:49 +02:00
Victor Stinner
f81f0f9c63
Issue #22117 : Fix rounding and implement _PyTime_ROUND_FLOOR in:
...
- _PyTime_ObjectToTime_t()
- _PyTime_ObjectToTimespec()
- _PyTime_ObjectToTimeval()
2015-03-30 00:44:06 +02:00
Victor Stinner
02937aab13
Issue #22117 : Add the new _PyTime_ROUND_FLOOR rounding method for the datetime
...
module. time.clock_settime() now uses this rounding method instead of
_PyTime_ROUND_DOWN to handle correctly dates before 1970.
2015-03-28 05:02:39 +01:00
Victor Stinner
95e9cef6f0
Issue #22117 : Write unit tests for _PyTime_AsTimeval()
...
* _PyTime_AsTimeval() now ensures that tv_usec is always positive
* _PyTime_AsTimespec() now ensures that tv_nsec is always positive
* _PyTime_AsTimeval() now returns an integer on overflow instead of raising an
exception
2015-03-28 01:26:47 +01:00
Victor Stinner
34dc0f46ae
Issue #22117 : The signal modules uses the new _PyTime_t API
...
* Add _PyTime_AsTimespec()
* Add unit tests for _PyTime_AsTimespec()
2015-03-27 18:19:03 +01:00
Victor Stinner
4bfb460d88
Issue #22117 : time.monotonic() now uses the new _PyTime_t API
...
* Add _PyTime_FromNanoseconds()
* Add _PyTime_AsSecondsDouble()
* Add unit tests for _PyTime_AsSecondsDouble()
2015-03-27 22:27:24 +01:00
Victor Stinner
992c43fec9
Issue #22117 : Fix rounding in _PyTime_FromSecondsObject()
...
* Rename _PyTime_FromObject() to _PyTime_FromSecondsObject()
* Add _PyTime_AsNanosecondsObject() and _testcapi.pytime_fromsecondsobject()
* Add unit tests
2015-03-27 17:12:45 +01:00
Victor Stinner
8c8b4e0ebf
Issue #11188 , #19748 : mktime() returns -1 on error. On Linux, the tm_wday field
...
is used as a sentinel () to detect if -1 is really an error or a valid
timestamp. On AIX, tm_wday is unchanged even on success and so cannot be used
as a sentinel.
2014-02-21 23:54:32 +01:00
Victor Stinner
1ac42614e3
Issue #19748 : On AIX, time.mktime() now raises an OverflowError for year
...
outsize range [1902; 2037].
2014-02-21 09:27:17 +01:00
Victor Stinner
3c1b379ebd
Issue #20320 : select.select() and select.kqueue.control() now round the timeout
...
aways from zero, instead of rounding towards zero.
It should make test_asyncio more reliable, especially test_timeout_rounding() test.
2014-02-17 00:02:43 +01:00
Serhiy Storchaka
f28ba369dd
Issue #20532 : Tests which use _testcapi now are marked as CPython only.
2014-02-07 10:10:55 +02:00
Serhiy Storchaka
5cfc79deae
Issue #20532 : Tests which use _testcapi now are marked as CPython only.
2014-02-07 10:06:39 +02:00
Zachary Ware
393a94243f
Issue #20101 : Merge with 3.3
2014-01-02 09:43:09 -06:00
Zachary Ware
487aedb77c
Issue #20101 : Allow test_monotonic to pass on Windows machines on which
...
time.get_clock_info('monotonic').resolution == 0.015600099999999999
This is just a workaround pending a real resolution to #20101 .
2014-01-02 09:41:10 -06:00
Victor Stinner
a4275b276c
(Merge 3.3) Close #19999 : tolerate coarse time when testing time.monotonic() on
...
very busy/slow buildbot
2013-12-16 22:38:46 +01:00
Victor Stinner
170078804c
Close #19999 : tolerate coarse time when testing time.monotonic() on very
...
busy/slow buildbot
2013-12-16 22:36:50 +01:00
Zachary Ware
101d9e7250
Issue 19572: More silently skipped tests explicitly skipped.
2013-12-08 00:44:27 -06:00
Zachary Ware
9fe6d86709
Issue 19572: More silently skipped tests explicitly skipped.
2013-12-08 00:20:35 -06:00
Serhiy Storchaka
b5d386314f
Issue #19545 : Avoid chained exceptions while passing stray % to
...
time.strptime(). Initial patch by Claudiu Popa.
2013-11-24 18:17:11 +02:00
Serhiy Storchaka
cdac302af3
Issue #19545 : Avoid chained exceptions while passing stray % to
...
time.strptime(). Initial patch by Claudiu Popa.
2013-11-24 18:15:37 +02:00
Victor Stinner
6c86181cd1
Issue #19715 : Ensure that consecutive calls to monotonic() are monotonic
2013-11-23 00:15:27 +01:00
Victor Stinner
a9c99a6119
test_time.test_monotonic(): use a longer sleep to try to make the test more reliable
2013-07-03 23:07:37 +02:00
Ezio Melotti
3836d70ed5
#17690 : test_time now works with unittest test discovery. Patch by Zachary Ware.
2013-04-11 20:29:42 +03:00
Ezio Melotti
0f38908684
#17572 : Avoid chained exceptions while passing bad directives to time.strptime(). Initial patch by Claudiu Popa.
2013-04-04 02:09:20 +03:00
Andrew Svetlov
5b89840d9c
Issue #16714 : use 'raise' exceptions, don't 'throw'.
...
Patch by Serhiy Storchaka.
2012-12-18 21:26:36 +02:00
Andrew Svetlov
737fb89dd1
Issue #16714 : use 'raise' exceptions, don't 'throw'.
...
Patch by Serhiy Storchaka.
2012-12-18 21:14:22 +02:00