17db96d56Sopenharmony_ci// The _PyTime_t API is written to use timestamp and timeout values stored in 27db96d56Sopenharmony_ci// various formats and to read clocks. 37db96d56Sopenharmony_ci// 47db96d56Sopenharmony_ci// The _PyTime_t type is an integer to support directly common arithmetic 57db96d56Sopenharmony_ci// operations like t1 + t2. 67db96d56Sopenharmony_ci// 77db96d56Sopenharmony_ci// The _PyTime_t API supports a resolution of 1 nanosecond. The _PyTime_t type 87db96d56Sopenharmony_ci// is signed to support negative timestamps. The supported range is around 97db96d56Sopenharmony_ci// [-292.3 years; +292.3 years]. Using the Unix epoch (January 1st, 1970), the 107db96d56Sopenharmony_ci// supported date range is around [1677-09-21; 2262-04-11]. 117db96d56Sopenharmony_ci// 127db96d56Sopenharmony_ci// Formats: 137db96d56Sopenharmony_ci// 147db96d56Sopenharmony_ci// * seconds 157db96d56Sopenharmony_ci// * seconds as a floating pointer number (C double) 167db96d56Sopenharmony_ci// * milliseconds (10^-3 seconds) 177db96d56Sopenharmony_ci// * microseconds (10^-6 seconds) 187db96d56Sopenharmony_ci// * 100 nanoseconds (10^-7 seconds) 197db96d56Sopenharmony_ci// * nanoseconds (10^-9 seconds) 207db96d56Sopenharmony_ci// * timeval structure, 1 microsecond resolution (10^-6 seconds) 217db96d56Sopenharmony_ci// * timespec structure, 1 nanosecond resolution (10^-9 seconds) 227db96d56Sopenharmony_ci// 237db96d56Sopenharmony_ci// Integer overflows are detected and raise OverflowError. Conversion to a 247db96d56Sopenharmony_ci// resolution worse than 1 nanosecond is rounded correctly with the requested 257db96d56Sopenharmony_ci// rounding mode. There are 4 rounding modes: floor (towards -inf), ceiling 267db96d56Sopenharmony_ci// (towards +inf), half even and up (away from zero). 277db96d56Sopenharmony_ci// 287db96d56Sopenharmony_ci// Some functions clamp the result in the range [_PyTime_MIN; _PyTime_MAX], so 297db96d56Sopenharmony_ci// the caller doesn't have to handle errors and doesn't need to hold the GIL. 307db96d56Sopenharmony_ci// For example, _PyTime_Add(t1, t2) computes t1+t2 and clamp the result on 317db96d56Sopenharmony_ci// overflow. 327db96d56Sopenharmony_ci// 337db96d56Sopenharmony_ci// Clocks: 347db96d56Sopenharmony_ci// 357db96d56Sopenharmony_ci// * System clock 367db96d56Sopenharmony_ci// * Monotonic clock 377db96d56Sopenharmony_ci// * Performance counter 387db96d56Sopenharmony_ci// 397db96d56Sopenharmony_ci// Operations like (t * k / q) with integers are implemented in a way to reduce 407db96d56Sopenharmony_ci// the risk of integer overflow. Such operation is used to convert a clock 417db96d56Sopenharmony_ci// value expressed in ticks with a frequency to _PyTime_t, like 427db96d56Sopenharmony_ci// QueryPerformanceCounter() with QueryPerformanceFrequency(). 437db96d56Sopenharmony_ci 447db96d56Sopenharmony_ci#ifndef Py_LIMITED_API 457db96d56Sopenharmony_ci#ifndef Py_PYTIME_H 467db96d56Sopenharmony_ci#define Py_PYTIME_H 477db96d56Sopenharmony_ci 487db96d56Sopenharmony_ci/************************************************************************** 497db96d56Sopenharmony_ciSymbols and macros to supply platform-independent interfaces to time related 507db96d56Sopenharmony_cifunctions and constants 517db96d56Sopenharmony_ci**************************************************************************/ 527db96d56Sopenharmony_ci#ifdef __cplusplus 537db96d56Sopenharmony_ciextern "C" { 547db96d56Sopenharmony_ci#endif 557db96d56Sopenharmony_ci 567db96d56Sopenharmony_ci/* _PyTime_t: Python timestamp with subsecond precision. It can be used to 577db96d56Sopenharmony_ci store a duration, and so indirectly a date (related to another date, like 587db96d56Sopenharmony_ci UNIX epoch). */ 597db96d56Sopenharmony_citypedef int64_t _PyTime_t; 607db96d56Sopenharmony_ci// _PyTime_MIN nanoseconds is around -292.3 years 617db96d56Sopenharmony_ci#define _PyTime_MIN INT64_MIN 627db96d56Sopenharmony_ci// _PyTime_MAX nanoseconds is around +292.3 years 637db96d56Sopenharmony_ci#define _PyTime_MAX INT64_MAX 647db96d56Sopenharmony_ci#define _SIZEOF_PYTIME_T 8 657db96d56Sopenharmony_ci 667db96d56Sopenharmony_citypedef enum { 677db96d56Sopenharmony_ci /* Round towards minus infinity (-inf). 687db96d56Sopenharmony_ci For example, used to read a clock. */ 697db96d56Sopenharmony_ci _PyTime_ROUND_FLOOR=0, 707db96d56Sopenharmony_ci /* Round towards infinity (+inf). 717db96d56Sopenharmony_ci For example, used for timeout to wait "at least" N seconds. */ 727db96d56Sopenharmony_ci _PyTime_ROUND_CEILING=1, 737db96d56Sopenharmony_ci /* Round to nearest with ties going to nearest even integer. 747db96d56Sopenharmony_ci For example, used to round from a Python float. */ 757db96d56Sopenharmony_ci _PyTime_ROUND_HALF_EVEN=2, 767db96d56Sopenharmony_ci /* Round away from zero 777db96d56Sopenharmony_ci For example, used for timeout. _PyTime_ROUND_CEILING rounds 787db96d56Sopenharmony_ci -1e-9 to 0 milliseconds which causes bpo-31786 issue. 797db96d56Sopenharmony_ci _PyTime_ROUND_UP rounds -1e-9 to -1 millisecond which keeps 807db96d56Sopenharmony_ci the timeout sign as expected. select.poll(timeout) must block 817db96d56Sopenharmony_ci for negative values." */ 827db96d56Sopenharmony_ci _PyTime_ROUND_UP=3, 837db96d56Sopenharmony_ci /* _PyTime_ROUND_TIMEOUT (an alias for _PyTime_ROUND_UP) should be 847db96d56Sopenharmony_ci used for timeouts. */ 857db96d56Sopenharmony_ci _PyTime_ROUND_TIMEOUT = _PyTime_ROUND_UP 867db96d56Sopenharmony_ci} _PyTime_round_t; 877db96d56Sopenharmony_ci 887db96d56Sopenharmony_ci 897db96d56Sopenharmony_ci/* Convert a time_t to a PyLong. */ 907db96d56Sopenharmony_ciPyAPI_FUNC(PyObject *) _PyLong_FromTime_t( 917db96d56Sopenharmony_ci time_t sec); 927db96d56Sopenharmony_ci 937db96d56Sopenharmony_ci/* Convert a PyLong to a time_t. */ 947db96d56Sopenharmony_ciPyAPI_FUNC(time_t) _PyLong_AsTime_t( 957db96d56Sopenharmony_ci PyObject *obj); 967db96d56Sopenharmony_ci 977db96d56Sopenharmony_ci/* Convert a number of seconds, int or float, to time_t. */ 987db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_ObjectToTime_t( 997db96d56Sopenharmony_ci PyObject *obj, 1007db96d56Sopenharmony_ci time_t *sec, 1017db96d56Sopenharmony_ci _PyTime_round_t); 1027db96d56Sopenharmony_ci 1037db96d56Sopenharmony_ci/* Convert a number of seconds, int or float, to a timeval structure. 1047db96d56Sopenharmony_ci usec is in the range [0; 999999] and rounded towards zero. 1057db96d56Sopenharmony_ci For example, -1.2 is converted to (-2, 800000). */ 1067db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_ObjectToTimeval( 1077db96d56Sopenharmony_ci PyObject *obj, 1087db96d56Sopenharmony_ci time_t *sec, 1097db96d56Sopenharmony_ci long *usec, 1107db96d56Sopenharmony_ci _PyTime_round_t); 1117db96d56Sopenharmony_ci 1127db96d56Sopenharmony_ci/* Convert a number of seconds, int or float, to a timespec structure. 1137db96d56Sopenharmony_ci nsec is in the range [0; 999999999] and rounded towards zero. 1147db96d56Sopenharmony_ci For example, -1.2 is converted to (-2, 800000000). */ 1157db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_ObjectToTimespec( 1167db96d56Sopenharmony_ci PyObject *obj, 1177db96d56Sopenharmony_ci time_t *sec, 1187db96d56Sopenharmony_ci long *nsec, 1197db96d56Sopenharmony_ci _PyTime_round_t); 1207db96d56Sopenharmony_ci 1217db96d56Sopenharmony_ci 1227db96d56Sopenharmony_ci/* Create a timestamp from a number of seconds. */ 1237db96d56Sopenharmony_ciPyAPI_FUNC(_PyTime_t) _PyTime_FromSeconds(int seconds); 1247db96d56Sopenharmony_ci 1257db96d56Sopenharmony_ci/* Macro to create a timestamp from a number of seconds, no integer overflow. 1267db96d56Sopenharmony_ci Only use the macro for small values, prefer _PyTime_FromSeconds(). */ 1277db96d56Sopenharmony_ci#define _PYTIME_FROMSECONDS(seconds) \ 1287db96d56Sopenharmony_ci ((_PyTime_t)(seconds) * (1000 * 1000 * 1000)) 1297db96d56Sopenharmony_ci 1307db96d56Sopenharmony_ci/* Create a timestamp from a number of nanoseconds. */ 1317db96d56Sopenharmony_ciPyAPI_FUNC(_PyTime_t) _PyTime_FromNanoseconds(_PyTime_t ns); 1327db96d56Sopenharmony_ci 1337db96d56Sopenharmony_ci/* Create a timestamp from nanoseconds (Python int). */ 1347db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_FromNanosecondsObject(_PyTime_t *t, 1357db96d56Sopenharmony_ci PyObject *obj); 1367db96d56Sopenharmony_ci 1377db96d56Sopenharmony_ci/* Convert a number of seconds (Python float or int) to a timestamp. 1387db96d56Sopenharmony_ci Raise an exception and return -1 on error, return 0 on success. */ 1397db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_FromSecondsObject(_PyTime_t *t, 1407db96d56Sopenharmony_ci PyObject *obj, 1417db96d56Sopenharmony_ci _PyTime_round_t round); 1427db96d56Sopenharmony_ci 1437db96d56Sopenharmony_ci/* Convert a number of milliseconds (Python float or int, 10^-3) to a timestamp. 1447db96d56Sopenharmony_ci Raise an exception and return -1 on error, return 0 on success. */ 1457db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_FromMillisecondsObject(_PyTime_t *t, 1467db96d56Sopenharmony_ci PyObject *obj, 1477db96d56Sopenharmony_ci _PyTime_round_t round); 1487db96d56Sopenharmony_ci 1497db96d56Sopenharmony_ci/* Convert a timestamp to a number of seconds as a C double. */ 1507db96d56Sopenharmony_ciPyAPI_FUNC(double) _PyTime_AsSecondsDouble(_PyTime_t t); 1517db96d56Sopenharmony_ci 1527db96d56Sopenharmony_ci/* Convert timestamp to a number of milliseconds (10^-3 seconds). */ 1537db96d56Sopenharmony_ciPyAPI_FUNC(_PyTime_t) _PyTime_AsMilliseconds(_PyTime_t t, 1547db96d56Sopenharmony_ci _PyTime_round_t round); 1557db96d56Sopenharmony_ci 1567db96d56Sopenharmony_ci/* Convert timestamp to a number of microseconds (10^-6 seconds). */ 1577db96d56Sopenharmony_ciPyAPI_FUNC(_PyTime_t) _PyTime_AsMicroseconds(_PyTime_t t, 1587db96d56Sopenharmony_ci _PyTime_round_t round); 1597db96d56Sopenharmony_ci 1607db96d56Sopenharmony_ci/* Convert timestamp to a number of nanoseconds (10^-9 seconds). */ 1617db96d56Sopenharmony_ciPyAPI_FUNC(_PyTime_t) _PyTime_AsNanoseconds(_PyTime_t t); 1627db96d56Sopenharmony_ci 1637db96d56Sopenharmony_ci#ifdef MS_WINDOWS 1647db96d56Sopenharmony_ci// Convert timestamp to a number of 100 nanoseconds (10^-7 seconds). 1657db96d56Sopenharmony_ciPyAPI_FUNC(_PyTime_t) _PyTime_As100Nanoseconds(_PyTime_t t, 1667db96d56Sopenharmony_ci _PyTime_round_t round); 1677db96d56Sopenharmony_ci#endif 1687db96d56Sopenharmony_ci 1697db96d56Sopenharmony_ci/* Convert timestamp to a number of nanoseconds (10^-9 seconds) as a Python int 1707db96d56Sopenharmony_ci object. */ 1717db96d56Sopenharmony_ciPyAPI_FUNC(PyObject *) _PyTime_AsNanosecondsObject(_PyTime_t t); 1727db96d56Sopenharmony_ci 1737db96d56Sopenharmony_ci#ifndef MS_WINDOWS 1747db96d56Sopenharmony_ci/* Create a timestamp from a timeval structure. 1757db96d56Sopenharmony_ci Raise an exception and return -1 on overflow, return 0 on success. */ 1767db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_FromTimeval(_PyTime_t *tp, struct timeval *tv); 1777db96d56Sopenharmony_ci#endif 1787db96d56Sopenharmony_ci 1797db96d56Sopenharmony_ci/* Convert a timestamp to a timeval structure (microsecond resolution). 1807db96d56Sopenharmony_ci tv_usec is always positive. 1817db96d56Sopenharmony_ci Raise an exception and return -1 if the conversion overflowed, 1827db96d56Sopenharmony_ci return 0 on success. */ 1837db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_AsTimeval(_PyTime_t t, 1847db96d56Sopenharmony_ci struct timeval *tv, 1857db96d56Sopenharmony_ci _PyTime_round_t round); 1867db96d56Sopenharmony_ci 1877db96d56Sopenharmony_ci/* Similar to _PyTime_AsTimeval() but don't raise an exception on overflow. 1887db96d56Sopenharmony_ci On overflow, clamp tv_sec to _PyTime_t min/max. */ 1897db96d56Sopenharmony_ciPyAPI_FUNC(void) _PyTime_AsTimeval_clamp(_PyTime_t t, 1907db96d56Sopenharmony_ci struct timeval *tv, 1917db96d56Sopenharmony_ci _PyTime_round_t round); 1927db96d56Sopenharmony_ci 1937db96d56Sopenharmony_ci/* Convert a timestamp to a number of seconds (secs) and microseconds (us). 1947db96d56Sopenharmony_ci us is always positive. This function is similar to _PyTime_AsTimeval() 1957db96d56Sopenharmony_ci except that secs is always a time_t type, whereas the timeval structure 1967db96d56Sopenharmony_ci uses a C long for tv_sec on Windows. 1977db96d56Sopenharmony_ci Raise an exception and return -1 if the conversion overflowed, 1987db96d56Sopenharmony_ci return 0 on success. */ 1997db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_AsTimevalTime_t( 2007db96d56Sopenharmony_ci _PyTime_t t, 2017db96d56Sopenharmony_ci time_t *secs, 2027db96d56Sopenharmony_ci int *us, 2037db96d56Sopenharmony_ci _PyTime_round_t round); 2047db96d56Sopenharmony_ci 2057db96d56Sopenharmony_ci#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE) 2067db96d56Sopenharmony_ci/* Create a timestamp from a timespec structure. 2077db96d56Sopenharmony_ci Raise an exception and return -1 on overflow, return 0 on success. */ 2087db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_FromTimespec(_PyTime_t *tp, struct timespec *ts); 2097db96d56Sopenharmony_ci 2107db96d56Sopenharmony_ci/* Convert a timestamp to a timespec structure (nanosecond resolution). 2117db96d56Sopenharmony_ci tv_nsec is always positive. 2127db96d56Sopenharmony_ci Raise an exception and return -1 on error, return 0 on success. */ 2137db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_AsTimespec(_PyTime_t t, struct timespec *ts); 2147db96d56Sopenharmony_ci 2157db96d56Sopenharmony_ci/* Similar to _PyTime_AsTimespec() but don't raise an exception on overflow. 2167db96d56Sopenharmony_ci On overflow, clamp tv_sec to _PyTime_t min/max. */ 2177db96d56Sopenharmony_ciPyAPI_FUNC(void) _PyTime_AsTimespec_clamp(_PyTime_t t, struct timespec *ts); 2187db96d56Sopenharmony_ci#endif 2197db96d56Sopenharmony_ci 2207db96d56Sopenharmony_ci 2217db96d56Sopenharmony_ci// Compute t1 + t2. Clamp to [_PyTime_MIN; _PyTime_MAX] on overflow. 2227db96d56Sopenharmony_ciPyAPI_FUNC(_PyTime_t) _PyTime_Add(_PyTime_t t1, _PyTime_t t2); 2237db96d56Sopenharmony_ci 2247db96d56Sopenharmony_ci/* Compute ticks * mul / div. 2257db96d56Sopenharmony_ci Clamp to [_PyTime_MIN; _PyTime_MAX] on overflow. 2267db96d56Sopenharmony_ci The caller must ensure that ((div - 1) * mul) cannot overflow. */ 2277db96d56Sopenharmony_ciPyAPI_FUNC(_PyTime_t) _PyTime_MulDiv(_PyTime_t ticks, 2287db96d56Sopenharmony_ci _PyTime_t mul, 2297db96d56Sopenharmony_ci _PyTime_t div); 2307db96d56Sopenharmony_ci 2317db96d56Sopenharmony_ci/* Structure used by time.get_clock_info() */ 2327db96d56Sopenharmony_citypedef struct { 2337db96d56Sopenharmony_ci const char *implementation; 2347db96d56Sopenharmony_ci int monotonic; 2357db96d56Sopenharmony_ci int adjustable; 2367db96d56Sopenharmony_ci double resolution; 2377db96d56Sopenharmony_ci} _Py_clock_info_t; 2387db96d56Sopenharmony_ci 2397db96d56Sopenharmony_ci/* Get the current time from the system clock. 2407db96d56Sopenharmony_ci 2417db96d56Sopenharmony_ci If the internal clock fails, silently ignore the error and return 0. 2427db96d56Sopenharmony_ci On integer overflow, silently ignore the overflow and clamp the clock to 2437db96d56Sopenharmony_ci [_PyTime_MIN; _PyTime_MAX]. 2447db96d56Sopenharmony_ci 2457db96d56Sopenharmony_ci Use _PyTime_GetSystemClockWithInfo() to check for failure. */ 2467db96d56Sopenharmony_ciPyAPI_FUNC(_PyTime_t) _PyTime_GetSystemClock(void); 2477db96d56Sopenharmony_ci 2487db96d56Sopenharmony_ci/* Get the current time from the system clock. 2497db96d56Sopenharmony_ci * On success, set *t and *info (if not NULL), and return 0. 2507db96d56Sopenharmony_ci * On error, raise an exception and return -1. 2517db96d56Sopenharmony_ci */ 2527db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_GetSystemClockWithInfo( 2537db96d56Sopenharmony_ci _PyTime_t *t, 2547db96d56Sopenharmony_ci _Py_clock_info_t *info); 2557db96d56Sopenharmony_ci 2567db96d56Sopenharmony_ci/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. 2577db96d56Sopenharmony_ci The clock is not affected by system clock updates. The reference point of 2587db96d56Sopenharmony_ci the returned value is undefined, so that only the difference between the 2597db96d56Sopenharmony_ci results of consecutive calls is valid. 2607db96d56Sopenharmony_ci 2617db96d56Sopenharmony_ci If the internal clock fails, silently ignore the error and return 0. 2627db96d56Sopenharmony_ci On integer overflow, silently ignore the overflow and clamp the clock to 2637db96d56Sopenharmony_ci [_PyTime_MIN; _PyTime_MAX]. 2647db96d56Sopenharmony_ci 2657db96d56Sopenharmony_ci Use _PyTime_GetMonotonicClockWithInfo() to check for failure. */ 2667db96d56Sopenharmony_ciPyAPI_FUNC(_PyTime_t) _PyTime_GetMonotonicClock(void); 2677db96d56Sopenharmony_ci 2687db96d56Sopenharmony_ci/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. 2697db96d56Sopenharmony_ci The clock is not affected by system clock updates. The reference point of 2707db96d56Sopenharmony_ci the returned value is undefined, so that only the difference between the 2717db96d56Sopenharmony_ci results of consecutive calls is valid. 2727db96d56Sopenharmony_ci 2737db96d56Sopenharmony_ci Fill info (if set) with information of the function used to get the time. 2747db96d56Sopenharmony_ci 2757db96d56Sopenharmony_ci Return 0 on success, raise an exception and return -1 on error. */ 2767db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_GetMonotonicClockWithInfo( 2777db96d56Sopenharmony_ci _PyTime_t *t, 2787db96d56Sopenharmony_ci _Py_clock_info_t *info); 2797db96d56Sopenharmony_ci 2807db96d56Sopenharmony_ci 2817db96d56Sopenharmony_ci/* Converts a timestamp to the Gregorian time, using the local time zone. 2827db96d56Sopenharmony_ci Return 0 on success, raise an exception and return -1 on error. */ 2837db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_localtime(time_t t, struct tm *tm); 2847db96d56Sopenharmony_ci 2857db96d56Sopenharmony_ci/* Converts a timestamp to the Gregorian time, assuming UTC. 2867db96d56Sopenharmony_ci Return 0 on success, raise an exception and return -1 on error. */ 2877db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_gmtime(time_t t, struct tm *tm); 2887db96d56Sopenharmony_ci 2897db96d56Sopenharmony_ci/* Get the performance counter: clock with the highest available resolution to 2907db96d56Sopenharmony_ci measure a short duration. 2917db96d56Sopenharmony_ci 2927db96d56Sopenharmony_ci If the internal clock fails, silently ignore the error and return 0. 2937db96d56Sopenharmony_ci On integer overflow, silently ignore the overflow and clamp the clock to 2947db96d56Sopenharmony_ci [_PyTime_MIN; _PyTime_MAX]. 2957db96d56Sopenharmony_ci 2967db96d56Sopenharmony_ci Use _PyTime_GetPerfCounterWithInfo() to check for failure. */ 2977db96d56Sopenharmony_ciPyAPI_FUNC(_PyTime_t) _PyTime_GetPerfCounter(void); 2987db96d56Sopenharmony_ci 2997db96d56Sopenharmony_ci/* Get the performance counter: clock with the highest available resolution to 3007db96d56Sopenharmony_ci measure a short duration. 3017db96d56Sopenharmony_ci 3027db96d56Sopenharmony_ci Fill info (if set) with information of the function used to get the time. 3037db96d56Sopenharmony_ci 3047db96d56Sopenharmony_ci Return 0 on success, raise an exception and return -1 on error. */ 3057db96d56Sopenharmony_ciPyAPI_FUNC(int) _PyTime_GetPerfCounterWithInfo( 3067db96d56Sopenharmony_ci _PyTime_t *t, 3077db96d56Sopenharmony_ci _Py_clock_info_t *info); 3087db96d56Sopenharmony_ci 3097db96d56Sopenharmony_ci 3107db96d56Sopenharmony_ci// Create a deadline. 3117db96d56Sopenharmony_ci// Pseudo code: _PyTime_GetMonotonicClock() + timeout. 3127db96d56Sopenharmony_ciPyAPI_FUNC(_PyTime_t) _PyDeadline_Init(_PyTime_t timeout); 3137db96d56Sopenharmony_ci 3147db96d56Sopenharmony_ci// Get remaining time from a deadline. 3157db96d56Sopenharmony_ci// Pseudo code: deadline - _PyTime_GetMonotonicClock(). 3167db96d56Sopenharmony_ciPyAPI_FUNC(_PyTime_t) _PyDeadline_Get(_PyTime_t deadline); 3177db96d56Sopenharmony_ci 3187db96d56Sopenharmony_ci#ifdef __cplusplus 3197db96d56Sopenharmony_ci} 3207db96d56Sopenharmony_ci#endif 3217db96d56Sopenharmony_ci 3227db96d56Sopenharmony_ci#endif /* Py_PYTIME_H */ 3237db96d56Sopenharmony_ci#endif /* Py_LIMITED_API */ 324