diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-09-02 21:18:25 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-09-02 21:18:25 (GMT) |
commit | ae58649721ec898ea4a101b0861e16fff3511cfa (patch) | |
tree | bb08b1a9b5f354212d7ca365d76659b09aed879a /Include/pytime.h | |
parent | 9bb758cee7f1694807ebe600b6230fb8e565d3ea (diff) | |
download | cpython-ae58649721ec898ea4a101b0861e16fff3511cfa.zip cpython-ae58649721ec898ea4a101b0861e16fff3511cfa.tar.gz cpython-ae58649721ec898ea4a101b0861e16fff3511cfa.tar.bz2 |
Issue #22043: time.monotonic() is now always available
threading.Lock.acquire(), threading.RLock.acquire() and socket operations now
use a monotonic clock, instead of the system clock, when a timeout is used.
Diffstat (limited to 'Include/pytime.h')
-rw-r--r-- | Include/pytime.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Include/pytime.h b/Include/pytime.h index 0f969b3..7a14456 100644 --- a/Include/pytime.h +++ b/Include/pytime.h @@ -91,6 +91,24 @@ 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); + /* Initialize time. Return 0 on success, raise an exception and return -1 on error. */ PyAPI_FUNC(int) _PyTime_Init(void); |