Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(387)

Side by Side Diff: Include/pytime.h

Issue 22043: Use a monotonic clock to compute timeouts
Patch Set: Created 3 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Doc/library/time.rst ('k') | Lib/queue.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #ifndef Py_LIMITED_API 1 #ifndef Py_LIMITED_API
2 #ifndef Py_PYTIME_H 2 #ifndef Py_PYTIME_H
3 #define Py_PYTIME_H 3 #define Py_PYTIME_H
4 4
5 #include "pyconfig.h" /* include for defines */ 5 #include "pyconfig.h" /* include for defines */
6 #include "object.h" 6 #include "object.h"
7 7
8 /************************************************************************** 8 /**************************************************************************
9 Symbols and macros to supply platform-independent interfaces to time related 9 Symbols and macros to supply platform-independent interfaces to time related
10 functions and constants 10 functions and constants
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 _PyTime_round_t); 85 _PyTime_round_t);
86 86
87 /* Convert a number of seconds, int or float, to a timespec structure. 87 /* Convert a number of seconds, int or float, to a timespec structure.
88 nsec is in the range [0; 999999999] and rounded towards zero. 88 nsec is in the range [0; 999999999] and rounded towards zero.
89 For example, -1.2 is converted to (-2, 800000000). */ 89 For example, -1.2 is converted to (-2, 800000000). */
90 PyAPI_FUNC(int) _PyTime_ObjectToTimespec( 90 PyAPI_FUNC(int) _PyTime_ObjectToTimespec(
91 PyObject *obj, 91 PyObject *obj,
92 time_t *sec, 92 time_t *sec,
93 long *nsec, 93 long *nsec,
94 _PyTime_round_t); 94 _PyTime_round_t);
95
96 /* Get the time of a monotonic clock, i.e. a clock that cannot go backwards.
97 The clock is not affected by system clock updates. The reference point of
98 the returned value is undefined, so that only the difference between the
99 results of consecutive calls is valid.
100
101 The function never fails. _PyTime_Init() ensures that a monotonic clock
102 is available and works. */
103 PyAPI_FUNC(void) _PyTime_monotonic(
104 _PyTime_timeval *tp);
105
106 /* Similar to _PyTime_monotonic(), fill also info (if set) with information of
107 the function used to get the time.
108
109 Return 0 on success, raise an exception and return -1 on error. */
110 PyAPI_FUNC(int) _PyTime_monotonic_info(
111 _PyTime_timeval *tp,
112 _Py_clock_info_t *info);
95 113
96 /* Initialize time. 114 /* Initialize time.
97 Return 0 on success, raise an exception and return -1 on error. */ 115 Return 0 on success, raise an exception and return -1 on error. */
98 PyAPI_FUNC(int) _PyTime_Init(void); 116 PyAPI_FUNC(int) _PyTime_Init(void);
99 #endif /* Py_LIMITED_API */ 117 #endif /* Py_LIMITED_API */
100 118
101 #ifdef __cplusplus 119 #ifdef __cplusplus
102 } 120 }
103 #endif 121 #endif
104 122
105 #endif /* Py_PYTIME_H */ 123 #endif /* Py_PYTIME_H */
106 #endif /* Py_LIMITED_API */ 124 #endif /* Py_LIMITED_API */
OLDNEW
« no previous file with comments | « Doc/library/time.rst ('k') | Lib/queue.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7