summaryrefslogtreecommitdiff
path: root/Include/pytime.h
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-03-12 10:32:20 +0100
committerVictor Stinner <victor.stinner@gmail.com>2015-03-12 10:32:20 +0100
commitb4d726f3b379fd28b021237669231da7041d8d72 (patch)
treeecef495715d6c5c51dd892b6638bc1efa3277174 /Include/pytime.h
parentf68d1650e89c4ca5b431637e1f2bca5b3bdfa551 (diff)
parentaef79164ae10e13c882ce2e10905809d16b85b09 (diff)
downloadcpython-b4d726f3b379fd28b021237669231da7041d8d72.tar.gz
Merge 3.4 (test_os)
Diffstat (limited to 'Include/pytime.h')
-rw-r--r--Include/pytime.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/Include/pytime.h b/Include/pytime.h
index b0fc6d0354..7a14456d3f 100644
--- a/Include/pytime.h
+++ b/Include/pytime.h
@@ -37,7 +37,7 @@ 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(
+PyAPI_FUNC(int) _PyTime_gettimeofday_info(
_PyTime_timeval *tp,
_Py_clock_info_t *info);
@@ -52,8 +52,6 @@ do { \
((tv_end.tv_sec - tv_start.tv_sec) + \
(tv_end.tv_usec - tv_start.tv_usec) * 0.000001)
-#ifndef Py_LIMITED_API
-
typedef enum {
/* Round towards zero. */
_PyTime_ROUND_DOWN=0,
@@ -92,10 +90,28 @@ PyAPI_FUNC(int) _PyTime_ObjectToTimespec(
time_t *sec,
long *nsec,
_PyTime_round_t);
-#endif
-/* Dummy to force linking. */
-PyAPI_FUNC(void) _PyTime_Init(void);
+/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards.
+ The clock is not affected by system clock updates. The reference point of
+ the returned value is undefined, so that only the difference between the
+ results of consecutive calls is valid.
+
+ The function never fails. _PyTime_Init() ensures that a monotonic clock
+ is available and works. */
+PyAPI_FUNC(void) _PyTime_monotonic(
+ _PyTime_timeval *tp);
+
+/* Similar to _PyTime_monotonic(), fill also 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_monotonic_info(
+ _PyTime_timeval *tp,
+ _Py_clock_info_t *info);
+
+/* Initialize time.
+ Return 0 on success, raise an exception and return -1 on error. */
+PyAPI_FUNC(int) _PyTime_Init(void);
#ifdef __cplusplus
}