diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-10-16 15:44:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-16 15:44:31 (GMT) |
commit | bdaeb7d237462a629e6c85001317faa85f94a0c6 (patch) | |
tree | 65dd0eb7017f7cb7dc79467afb655d3b56337100 /Include | |
parent | 0df19055c92a0b0728659807978e4ca4d6c8e1bc (diff) | |
download | cpython-bdaeb7d237462a629e6c85001317faa85f94a0c6.zip cpython-bdaeb7d237462a629e6c85001317faa85f94a0c6.tar.gz cpython-bdaeb7d237462a629e6c85001317faa85f94a0c6.tar.bz2 |
bpo-31773: _PyTime_GetPerfCounter() uses _PyTime_t (GH-3983)
* Rewrite win_perf_counter() to only use integers internally.
* Add _PyTime_MulDiv() which compute "ticks * mul / div"
in two parts (int part and remaining) to prevent integer overflow.
* Clock frequency is checked at initialization for integer overflow.
* Enhance also pymonotonic() to reduce the precision loss on macOS
(mach_absolute_time() clock).
Diffstat (limited to 'Include')
-rw-r--r-- | Include/pytime.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Include/pytime.h b/Include/pytime.h index fd95045..488fdc4 100644 --- a/Include/pytime.h +++ b/Include/pytime.h @@ -197,7 +197,7 @@ PyAPI_FUNC(int) _PyTime_gmtime(time_t t, struct tm *tm); The function cannot fail. _PyTime_Init() ensures that the system clock works. */ -PyAPI_FUNC(double) _PyTime_GetPerfCounterDouble(void); +PyAPI_FUNC(_PyTime_t) _PyTime_GetPerfCounter(void); /* Get the performance counter: clock with the highest available resolution to measure a short duration. @@ -205,8 +205,8 @@ PyAPI_FUNC(double) _PyTime_GetPerfCounterDouble(void); Fill 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_GetPerfCounterDoubleWithInfo( - double *t, +PyAPI_FUNC(int) _PyTime_GetPerfCounterWithInfo( + _PyTime_t *t, _Py_clock_info_t *info); #ifdef __cplusplus |