mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
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.
This commit is contained in:
parent
9bb758cee7
commit
ae58649721
17 changed files with 226 additions and 176 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue