mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
* Rename time.steady() to time.monotonic() * On Windows, time.monotonic() uses GetTickCount/GetTickCount64() instead of QueryPerformanceCounter() * time.monotonic() uses CLOCK_HIGHRES if available * Add time.get_clock_info(), time.perf_counter() and time.process_time() functions
This commit is contained in:
parent
ca6e40f12a
commit
ec89539ccc
9 changed files with 729 additions and 133 deletions
|
|
@ -22,11 +22,25 @@ typedef struct {
|
|||
} _PyTime_timeval;
|
||||
#endif
|
||||
|
||||
/* Structure used by time.get_clock_info() */
|
||||
typedef struct {
|
||||
const char *implementation;
|
||||
int is_monotonic;
|
||||
int is_adjusted;
|
||||
double resolution;
|
||||
} _Py_clock_info_t;
|
||||
|
||||
/* Similar to POSIX gettimeofday but cannot fail. If system gettimeofday
|
||||
* fails or is not available, fall back to lower resolution clocks.
|
||||
*/
|
||||
PyAPI_FUNC(void) _PyTime_gettimeofday(_PyTime_timeval *tp);
|
||||
|
||||
/* Similar to _PyTime_gettimeofday() but retrieve also information on the
|
||||
* clock used to get the current time. */
|
||||
PyAPI_FUNC(void) _PyTime_gettimeofday_info(
|
||||
_PyTime_timeval *tp,
|
||||
_Py_clock_info_t *info);
|
||||
|
||||
#define _PyTime_ADD_SECONDS(tv, interval) \
|
||||
do { \
|
||||
tv.tv_usec += (long) (((long) interval - interval) * 1000000); \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue