| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
This reverts commit e34b5f4d6483187969d5149c801d056b72ef2ddb.
|
| |
|
| |
(cherry picked from commit 8f4ef3b019ce380022018587571b0f970e668de3)
|
| |
|
|
|
|
|
|
| |
Change test_time.test_monotonic() to test only the lower bound of elapsed time
after a sleep command rather than the upper bound. This prevents unnecessary
test failures on slow buildbots. Patch by Victor Stinner.
(cherry picked from commit d246a6766b9d8cc625112906299c4cb019944300)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
|
| |
|
|
|
|
|
| |
The "busy loops" of test_process_time() and test_thread_time() are
not reliable and fail randomly on Windows: remove them.
(cherry picked from commit 48498dd57f79ab1d061c754ad6a2ebe1a7172b0e)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
|
| |
|
|
|
|
| |
Tolerate up to 30 ms, instead of 15 min, in other threads.
(cherry picked from commit 65c216e74f7957006ef7653b7e2afe83007c45ce)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
|
| |
|
|
|
| |
(cherry picked from commit e1a34ceb541ef87e03bb428630097dacc9c658e5)
Co-authored-by: Benjamin Peterson <benjamin@python.org>
|
| |
|
|
|
|
| |
Avoids an integer underflow in the time module's year handling code.
(cherry picked from commit 76be0fffff8b7dbe649ad4821144461800ffb0d0)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
|
| |
|
|
|
|
|
| |
(#8383)
(cherry picked from commit 938045f335b52ddb47076e9fbe4229a33b4bd9be)
Co-authored-by: Bo Bayles <bbayles@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
The test failed on my laptop because the busy loop took 15.9 ms
whereas the test expects at least 20 ms. Modify test_process_time()
as test_thread_time() has been modified recently: only require 15 ms
instead of 20 ms.
(cherry picked from commit e78dace8dcb23c371df19c9add65895adf436995)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
|
| |
|
|
|
|
|
|
|
| |
The test failed on AMD64 Debian root 3.x buildbot because the busy
loop of 100 ms only increased time.thread_time() by 19.9 ms which is
smaller than 20 ms. Modify the test to tolerate a delta of at least
15 ms instead of 20 ms.
(cherry picked from commit d6345def68d3a0227253da26213dadb247f786db)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* bpo-32025: Add time.thread_time()
* Add missing #endif
* Add NEWS blurb
* Add docs and whatsnew
* Address review comments
* Review comments
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add new time functions:
* time.clock_gettime_ns()
* time.clock_settime_ns()
* time.monotonic_ns()
* time.perf_counter_ns()
* time.process_time_ns()
* time.time_ns()
Add new _PyTime functions:
* _PyTime_FromTimespec()
* _PyTime_FromNanosecondsObject()
* _PyTime_FromTimeval()
Other changes:
* Add also os.times() tests to test_os.
* pytime_fromtimeval() and pytime_fromtimeval() now return
_PyTime_MAX or _PyTime_MIN on overflow, rather than undefined
behaviour
* _PyTime_FromNanoseconds() parameter type changes from long long to
_PyTime_t
|
| |
|
|
|
|
|
|
|
|
| |
bpo-31803: time.clock() and time.get_clock_info('clock') now emit a
DeprecationWarning warning.
Replace time.clock() with time.perf_counter() in tests and demos.
Remove also hasattr(time, 'monotonic') in test_time since time.monotonic()
is now always available since Python 3.5.
|
| |
|
|
| |
small negative value. (#4003)
|
| |
|
| |
There just isn't much we can assert in a portable way.
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
* Fix #26669
* Modify NaN check function and error message
* Fix pytime.c when arg is nan
* fix whitespace
|
| |
|
|
|
|
| |
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
|
| |
|
|
|
|
|
| |
Based on patch by Victor Stinner.
Add private C API function _PyUnicode_AsUnicode() which is similar to
PyUnicode_AsUnicode(), but checks for null characters.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
Filter also values for check_float_rounding().
|
| |
|
|
| |
Filter values which would overflow when converted to a C time_t type.
|
| |
|
|
|
|
|
| |
* 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
|
| |
|
|
|
|
|
|
|
|
| |
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().
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |\ |
|
| | | |
|
| | | |
|
| |\ \ |
|
| | |\ \
| | |/
| |/| |
|
| |\ \ \
| |/ / |
|
| | | | |
|
| | | |
| | |
| | |
| | |
| | | |
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp().
microseconds sign should be kept before rounding.
|
| | | |
| | |
| | |
| | | |
_PyTime_ObjectToTimespec()
|
| | | |
| | |
| | |
| | | |
rounding
|
| | | | |
|
| | | |
| | |
| | |
| | | |
used.
|
| |/ / |
|
| | | |
|
| | |
| |
| |
| |
| | |
Fix also _Py_InitializeEx_Private(): initialize time before initializing
import, import_init() uses the _PyTime API (for thread locks).
|
| | |
| |
| |
| |
| |
| | |
_PyTime_AsMicroseconds() rounding.
Add also unit tests.
|
| | |
| |
| |
| | |
Use _PyTime_ROUND_FLOOR and _PyTime_ROUND_CEILING instead.
|
| | |
| |
| |
| | |
Add also more tests for ROUNd_FLOOR.
|
| | |
| |
| |
| |
| |
| | |
- _PyTime_ObjectToTime_t()
- _PyTime_ObjectToTimespec()
- _PyTime_ObjectToTimeval()
|
| | |
| |
| |
| |
| | |
module. time.clock_settime() now uses this rounding method instead of
_PyTime_ROUND_DOWN to handle correctly dates before 1970.
|
| | |
| |
| |
| |
| |
| |
| | |
* _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
|
| | |
| |
| |
| |
| | |
* Add _PyTime_AsTimespec()
* Add unit tests for _PyTime_AsTimespec()
|
| | |
| |
| |
| |
| |
| | |
* Add _PyTime_FromNanoseconds()
* Add _PyTime_AsSecondsDouble()
* Add unit tests for _PyTime_AsSecondsDouble()
|
| |/
|
|
|
|
| |
* Rename _PyTime_FromObject() to _PyTime_FromSecondsObject()
* Add _PyTime_AsNanosecondsObject() and _testcapi.pytime_fromsecondsobject()
* Add unit tests
|