Issue #14428, #14397: Implement the PEP 418
* 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
diff --git a/Include/pytime.h b/Include/pytime.h
index 221279b..a0cedb2 100644
--- a/Include/pytime.h
+++ b/Include/pytime.h
@@ -22,11 +22,25 @@
} _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); \