aboutsummaryrefslogtreecommitdiff
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-09-30 03:07:11 +0200
committerGitHub <noreply@github.com>2021-09-30 03:07:11 +0200
commitd62d925823b005c33b432e527562b573a3a89635 (patch)
tree01b09ab366d0c4ccd99d4f5e38b8dd1ce479f958 /Include
parent09796f2f142fdb1214f34a3ca917959ecb32a88b (diff)
downloadcpython3-d62d925823b005c33b432e527562b573a3a89635.tar.gz
bpo-41710: Add pytime_add() and pytime_mul() (GH-28642)
Add pytime_add() and pytime_mul() functions to pytime.c to compute t+t2 and t*k with clamping to [_PyTime_MIN; _PyTime_MAX]. Fix pytime.h: _PyTime_FromTimeval() is not implemented on Windows.
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/pytime.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/Include/cpython/pytime.h b/Include/cpython/pytime.h
index 04c43ac5d4..b5a351349f 100644
--- a/Include/cpython/pytime.h
+++ b/Include/cpython/pytime.h
@@ -125,9 +125,11 @@ PyAPI_FUNC(_PyTime_t) _PyTime_As100Nanoseconds(_PyTime_t t,
object. */
PyAPI_FUNC(PyObject *) _PyTime_AsNanosecondsObject(_PyTime_t t);
+#ifndef MS_WINDOWS
/* Create a timestamp from a timeval structure.
Raise an exception and return -1 on overflow, return 0 on success. */
PyAPI_FUNC(int) _PyTime_FromTimeval(_PyTime_t *tp, struct timeval *tv);
+#endif
/* Convert a timestamp to a timeval structure (microsecond resolution).
tv_usec is always positive.
@@ -188,7 +190,7 @@ typedef struct {
If the internal clock fails, silently ignore the error and return 0.
On integer overflow, silently ignore the overflow and clamp the clock to
- _PyTime_MIN or _PyTime_MAX.
+ [_PyTime_MIN; _PyTime_MAX].
Use _PyTime_GetSystemClockWithInfo() to check for failure. */
PyAPI_FUNC(_PyTime_t) _PyTime_GetSystemClock(void);
@@ -208,7 +210,7 @@ PyAPI_FUNC(int) _PyTime_GetSystemClockWithInfo(
If the internal clock fails, silently ignore the error and return 0.
On integer overflow, silently ignore the overflow and clamp the clock to
- _PyTime_MIN or _PyTime_MAX.
+ [_PyTime_MIN; _PyTime_MAX].
Use _PyTime_GetMonotonicClockWithInfo() to check for failure. */
PyAPI_FUNC(_PyTime_t) _PyTime_GetMonotonicClock(void);
@@ -239,7 +241,7 @@ PyAPI_FUNC(int) _PyTime_gmtime(time_t t, struct tm *tm);
If the internal clock fails, silently ignore the error and return 0.
On integer overflow, silently ignore the overflow and clamp the clock to
- _PyTime_MIN or _PyTime_MAX.
+ [_PyTime_MIN; _PyTime_MAX].
Use _PyTime_GetPerfCounterWithInfo() to check for failure. */
PyAPI_FUNC(_PyTime_t) _PyTime_GetPerfCounter(void);