diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-02-16 23:02:43 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-02-16 23:02:43 (GMT) |
commit | 3c1b379ebd701cbd7686d0f0be95b88c5b3da8fe (patch) | |
tree | c1759ff720c8226c333052f6773c97d5b5c6356e /Include/pytime.h | |
parent | 23f628de4ab75acde14de9593793e67ec74d851c (diff) | |
download | cpython-3c1b379ebd701cbd7686d0f0be95b88c5b3da8fe.zip cpython-3c1b379ebd701cbd7686d0f0be95b88c5b3da8fe.tar.gz cpython-3c1b379ebd701cbd7686d0f0be95b88c5b3da8fe.tar.bz2 |
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.
Diffstat (limited to 'Include/pytime.h')
-rw-r--r-- | Include/pytime.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Include/pytime.h b/Include/pytime.h index 52902f5..b0fc6d0 100644 --- a/Include/pytime.h +++ b/Include/pytime.h @@ -53,10 +53,19 @@ do { \ (tv_end.tv_usec - tv_start.tv_usec) * 0.000001) #ifndef Py_LIMITED_API + +typedef enum { + /* Round towards zero. */ + _PyTime_ROUND_DOWN=0, + /* Round away from zero. */ + _PyTime_ROUND_UP +} _PyTime_round_t; + /* Convert a number of seconds, int or float, to time_t. */ PyAPI_FUNC(int) _PyTime_ObjectToTime_t( PyObject *obj, - time_t *sec); + time_t *sec, + _PyTime_round_t); /* Convert a time_t to a PyLong. */ PyAPI_FUNC(PyObject *) _PyLong_FromTime_t( @@ -72,7 +81,8 @@ PyAPI_FUNC(time_t) _PyLong_AsTime_t( PyAPI_FUNC(int) _PyTime_ObjectToTimeval( PyObject *obj, time_t *sec, - long *usec); + long *usec, + _PyTime_round_t); /* Convert a number of seconds, int or float, to a timespec structure. nsec is in the range [0; 999999999] and rounded towards zero. @@ -80,7 +90,8 @@ PyAPI_FUNC(int) _PyTime_ObjectToTimeval( PyAPI_FUNC(int) _PyTime_ObjectToTimespec( PyObject *obj, time_t *sec, - long *nsec); + long *nsec, + _PyTime_round_t); #endif /* Dummy to force linking. */ |