summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_time.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix typo in test_time.pyVictor Stinner2016-08-171-1/+1
|
* pytime: add _PyTime_check_mul_overflow() macro to avoid undefined behaviourVictor Stinner2015-09-101-1/+2
| | | | | | | | | | | 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.
* Fix test_time on platform with 32-bit time_t typeVictor Stinner2015-09-101-3/+6
| | | | Filter also values for check_float_rounding().
* Fix test_time on platform with 32-bit time_t typeVictor Stinner2015-09-101-5/+18
| | | | Filter values which would overflow when converted to a C time_t type.
* Fix test_time on WindowsVictor Stinner2015-09-101-9/+24
| | | | | | | * 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
* test_time: rewrite PyTime API rounding testsVictor Stinner2015-09-091-562/+234
| | | | | | | | | | 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().
* Issue #23517: fromtimestamp() and utcfromtimestamp() methods ofVictor Stinner2015-09-081-135/+110
| | | | | | | | | | | | 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.
* Merge from 3.5Steve Dower2015-09-071-0/+13
|\
| * Issue #24917: time_strftime() buffer over-read.Steve Dower2015-09-071-0/+13
| |
| * Backing out 09b62202d9b7; the tests fail on Linux, and it needs a re-think.Larry Hastings2015-09-061-6/+0
| |
* | Issue #24917: Backed out changeset 09b62202d9b7Steve Dower2015-09-061-6/+0
|\ \
| * \ Issue #24917: Backed out changeset 09b62202d9b7Steve Dower2015-09-061-6/+0
| |\ \ | | |/ | |/|
* | | Issue #24917: time_strftime() Buffer Over-read. Patch by John Leitch.Steve Dower2015-09-061-0/+6
|\ \ \ | |/ /
| * | Issue #24917: time_strftime() Buffer Over-read. Patch by John Leitch.Steve Dower2015-09-051-0/+6
| | |
* | | Issue #23517: Fix implementation of the ROUND_HALF_UP rounding mode inVictor Stinner2015-09-041-6/+7
| | | | | | | | | | | | | | | datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp(). microseconds sign should be kept before rounding.
* | | test_time: add tests on HALF_UP rounding mode for _PyTime_ObjectToTime_t() andVictor Stinner2015-09-041-40/+90
| | | | | | | | | | | | _PyTime_ObjectToTimespec()
* | | Issue #23517: test_time, skip a test checking a corner case on floating pointVictor Stinner2015-09-021-1/+3
| | | | | | | | | | | | rounding
* | | test_time: add more tests on HALF_UP rounding modeVictor Stinner2015-09-021-8/+28
| | |
* | | Issue #23517: Reintroduce unit tests for the old PyTime API since it's stillVictor Stinner2015-09-021-0/+154
| | | | | | | | | | | | used.
* | | Issue #23517: Add "half up" rounding mode to the _PyTime APIVictor Stinner2015-09-011-3/+61
|/ /
* | Closes #24244: Removes invalid test from test_timeSteve Dower2015-06-241-7/+0
| |
* | Issue #22117: Add a new _PyTime_FromSeconds() functionVictor Stinner2015-04-031-0/+7
| | | | | | | | | | Fix also _Py_InitializeEx_Private(): initialize time before initializing import, import_init() uses the _PyTime API (for thread locks).
* | Issue #22117, issue #23485: Fix _PyTime_AsMilliseconds() andVictor Stinner2015-04-011-4/+72
| | | | | | | | | | | | _PyTime_AsMicroseconds() rounding. Add also unit tests.
* | Issue #22117: Remove _PyTime_ROUND_DOWN and _PyTime_ROUND_UP rounding methodsVictor Stinner2015-03-301-87/+13
| | | | | | | | Use _PyTime_ROUND_FLOOR and _PyTime_ROUND_CEILING instead.
* | Issue #22117: Add _PyTime_ROUND_CEILING rounding method for timestampsVictor Stinner2015-03-301-4/+61
| | | | | | | | Add also more tests for ROUNd_FLOOR.
* | Issue #22117: Fix rounding and implement _PyTime_ROUND_FLOOR in:Victor Stinner2015-03-291-2/+2
| | | | | | | | | | | | - _PyTime_ObjectToTime_t() - _PyTime_ObjectToTimespec() - _PyTime_ObjectToTimeval()
* | Issue #22117: Add the new _PyTime_ROUND_FLOOR rounding method for the datetimeVictor Stinner2015-03-281-48/+18
| | | | | | | | | | module. time.clock_settime() now uses this rounding method instead of _PyTime_ROUND_DOWN to handle correctly dates before 1970.
* | Issue #22117: Write unit tests for _PyTime_AsTimeval()Victor Stinner2015-03-281-0/+38
| | | | | | | | | | | | | | * _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
* | Issue #22117: The signal modules uses the new _PyTime_t APIVictor Stinner2015-03-271-1/+28
| | | | | | | | | | * Add _PyTime_AsTimespec() * Add unit tests for _PyTime_AsTimespec()
* | Issue #22117: time.monotonic() now uses the new _PyTime_t APIVictor Stinner2015-03-271-10/+54
| | | | | | | | | | | | * Add _PyTime_FromNanoseconds() * Add _PyTime_AsSecondsDouble() * Add unit tests for _PyTime_AsSecondsDouble()
* | Issue #22117: Fix rounding in _PyTime_FromSecondsObject()Victor Stinner2015-03-271-79/+173
|/ | | | | | * Rename _PyTime_FromObject() to _PyTime_FromSecondsObject() * Add _PyTime_AsNanosecondsObject() and _testcapi.pytime_fromsecondsobject() * Add unit tests
* Issue #11188, #19748: mktime() returns -1 on error. On Linux, the tm_wday fieldVictor Stinner2014-02-211-0/+7
| | | | | | 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.
* Issue #19748: On AIX, time.mktime() now raises an OverflowError for yearVictor Stinner2014-02-211-1/+1
| | | | outsize range [1902; 2037].
* Issue #20320: select.select() and select.kqueue.control() now round the timeoutVictor Stinner2014-02-161-35/+95
| | | | | | aways from zero, instead of rounding towards zero. It should make test_asyncio more reliable, especially test_timeout_rounding() test.
* Issue #20532: Tests which use _testcapi now are marked as CPython only.Serhiy Storchaka2014-02-071-0/+3
|\
| * Issue #20532: Tests which use _testcapi now are marked as CPython only.Serhiy Storchaka2014-02-071-0/+3
| |
* | Issue #20101: Merge with 3.3Zachary Ware2014-01-021-1/+2
|\ \ | |/
| * Issue #20101: Allow test_monotonic to pass on Windows machines on whichZachary Ware2014-01-021-1/+2
| | | | | | | | | | | | time.get_clock_info('monotonic').resolution == 0.015600099999999999 This is just a workaround pending a real resolution to #20101.
* | (Merge 3.3) Close #19999: tolerate coarse time when testing time.monotonic() onVictor Stinner2013-12-161-1/+1
|\ \ | |/ | | | | very busy/slow buildbot
| * Close #19999: tolerate coarse time when testing time.monotonic() on veryVictor Stinner2013-12-161-1/+1
| | | | | | | | busy/slow buildbot
* | Issue 19572: More silently skipped tests explicitly skipped.Zachary Ware2013-12-081-2/+1
|\ \ | |/
| * Issue 19572: More silently skipped tests explicitly skipped.Zachary Ware2013-12-081-2/+1
| |
* | Issue #19545: Avoid chained exceptions while passing stray % toSerhiy Storchaka2013-11-241-0/+4
|\ \ | |/ | | | | time.strptime(). Initial patch by Claudiu Popa.
| * Issue #19545: Avoid chained exceptions while passing stray % toSerhiy Storchaka2013-11-241-0/+4
| | | | | | | | time.strptime(). Initial patch by Claudiu Popa.
* | Issue #19715: Ensure that consecutive calls to monotonic() are monotonicVictor Stinner2013-11-221-0/+9
|/
* test_time.test_monotonic(): use a longer sleep to try to make the test more ↵Victor Stinner2013-07-031-2/+2
| | | | reliable
* #17690: test_time now works with unittest test discovery. Patch by Zachary ↵Ezio Melotti2013-04-111-15/+4
| | | | Ware.
* #17572: Avoid chained exceptions while passing bad directives to ↵Ezio Melotti2013-04-031-0/+6
| | | | time.strptime(). Initial patch by Claudiu Popa.
* Issue #16714: use 'raise' exceptions, don't 'throw'.Andrew Svetlov2012-12-181-1/+1
|\ | | | | | | Patch by Serhiy Storchaka.
| * Issue #16714: use 'raise' exceptions, don't 'throw'.Andrew Svetlov2012-12-181-1/+1
| | | | | | | | Patch by Serhiy Storchaka.