diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-28 02:52:05 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-28 02:52:05 (GMT) |
commit | f5faad2bf017db9e99845de29420476914f1ef1d (patch) | |
tree | bfe86d93267dd2c4cc49181a7289437e2ada4b64 /Include | |
parent | e245231fabb4c97521959e9ae1b45469bfad0d1e (diff) | |
download | cpython-f5faad2bf017db9e99845de29420476914f1ef1d.zip cpython-f5faad2bf017db9e99845de29420476914f1ef1d.tar.gz cpython-f5faad2bf017db9e99845de29420476914f1ef1d.tar.bz2 |
Issue #22117: The thread module uses the new _PyTime_t timestamp API
Add also a new _PyTime_AsMicroseconds() function.
threading.TIMEOUT_MAX is now be smaller: only 292 years instead of 292,271
years on 64-bit system for example. Sorry, your threads will hang a *little
bit* shorter. Call me if you want to ensure that your locks wait longer, I can
share some tricks with you.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/pytime.h | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/Include/pytime.h b/Include/pytime.h index 3004289..3078d25 100644 --- a/Include/pytime.h +++ b/Include/pytime.h @@ -74,24 +74,6 @@ PyAPI_FUNC(int) _PyTime_ObjectToTimespec( long *nsec, _PyTime_round_t); -/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. - The clock is not affected by system clock updates. The reference point of - the returned value is undefined, so that only the difference between the - results of consecutive calls is valid. - - The function never fails. _PyTime_Init() ensures that a monotonic clock - is available and works. */ -PyAPI_FUNC(void) _PyTime_monotonic( - _PyTime_timeval *tp); - -/* Similar to _PyTime_monotonic(), fill also info (if set) with information of - the function used to get the time. - - Return 0 on success, raise an exception and return -1 on error. */ -PyAPI_FUNC(int) _PyTime_monotonic_info( - _PyTime_timeval *tp, - _Py_clock_info_t *info); - /* Add interval seconds to tv */ PyAPI_FUNC(void) _PyTime_AddDouble(_PyTime_timeval *tv, double interval, @@ -105,6 +87,8 @@ PyAPI_FUNC(int) _PyTime_Init(void); #ifdef PY_INT64_T typedef PY_INT64_T _PyTime_t; +#define _PyTime_MIN PY_LLONG_MIN +#define _PyTime_MAX PY_LLONG_MAX #else # error "_PyTime_t need signed 64-bit integer type" #endif @@ -125,6 +109,10 @@ PyAPI_FUNC(double) _PyTime_AsSecondsDouble(_PyTime_t t); PyAPI_FUNC(_PyTime_t) _PyTime_AsMilliseconds(_PyTime_t t, _PyTime_round_t round); +/* Convert timestamp to a number of microseconds (10^-6 seconds). */ +PyAPI_FUNC(_PyTime_t) _PyTime_AsMicroseconds(_PyTime_t t, + _PyTime_round_t round); + /* Convert timestamp to a number of nanoseconds (10^-9 seconds) as a Python int object. */ PyAPI_FUNC(PyObject *) _PyTime_AsNanosecondsObject(_PyTime_t t); |