summaryrefslogtreecommitdiff
path: root/Include/cpython
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-06-17 16:11:13 +0200
committerGitHub <noreply@github.com>2022-06-17 16:11:13 +0200
commite444752fabb691593af9e2f767419bb5fd6ba507 (patch)
tree137c1bee2d8875ebf318f49de87a8812ac3e2dcf /Include/cpython
parent17357108732c731d6ed4f2bd123ee6ba1ff6891b (diff)
downloadcpython-git-e444752fabb691593af9e2f767419bb5fd6ba507.tar.gz
gh-74953: Add _PyTime_FromMicrosecondsClamp() function (#93942)
Diffstat (limited to 'Include/cpython')
-rw-r--r--Include/cpython/pytime.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/Include/cpython/pytime.h b/Include/cpython/pytime.h
index 23d4f16a8f..e64f3b13e7 100644
--- a/Include/cpython/pytime.h
+++ b/Include/cpython/pytime.h
@@ -130,6 +130,10 @@ PyAPI_FUNC(_PyTime_t) _PyTime_FromSeconds(int seconds);
/* Create a timestamp from a number of nanoseconds. */
PyAPI_FUNC(_PyTime_t) _PyTime_FromNanoseconds(_PyTime_t ns);
+/* Create a timestamp from a number of microseconds.
+ * Clamp to [_PyTime_MIN; _PyTime_MAX] on overflow. */
+PyAPI_FUNC(_PyTime_t) _PyTime_FromMicrosecondsClamp(_PyTime_t us);
+
/* Create a timestamp from nanoseconds (Python int). */
PyAPI_FUNC(int) _PyTime_FromNanosecondsObject(_PyTime_t *t,
PyObject *obj);