diff options
author | Victor Stinner <vstinner@python.org> | 2024-05-05 12:15:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-05 12:15:19 +0200 |
commit | aa61f8bfcf2584dd8345f1f9a07e240100b79192 (patch) | |
tree | db196e9316a20ff332290c56b60c38a6b533fae6 /Python/pytime.c | |
parent | c7c9b913c01afb8d2ff4048f82155969f7ef75b1 (diff) | |
download | cpython-aa61f8bfcf2584dd8345f1f9a07e240100b79192.tar.gz cpython-aa61f8bfcf2584dd8345f1f9a07e240100b79192.zip |
gh-110850: Remove _PyTime_TimeUnchecked() function (#118552)
Use the new public Raw functions:
* _PyTime_PerfCounterUnchecked() with PyTime_PerfCounterRaw()
* _PyTime_TimeUnchecked() with PyTime_TimeRaw()
* _PyTime_MonotonicUnchecked() with PyTime_MonotonicRaw()
Remove internal functions:
* _PyTime_PerfCounterUnchecked()
* _PyTime_TimeUnchecked()
* _PyTime_MonotonicUnchecked()
Diffstat (limited to 'Python/pytime.c')
-rw-r--r-- | Python/pytime.c | 47 |
1 files changed, 6 insertions, 41 deletions
diff --git a/Python/pytime.c b/Python/pytime.c index 12b36bbc881..560aea33f20 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -1030,22 +1030,6 @@ PyTime_TimeRaw(PyTime_t *result) } -PyTime_t -_PyTime_TimeUnchecked(void) -{ - PyTime_t t; -#ifdef Py_DEBUG - int result = PyTime_TimeRaw(&t); - if (result != 0) { - Py_FatalError("unable to read the system clock"); - } -#else - (void)PyTime_TimeRaw(&t); -#endif - return t; -} - - int _PyTime_TimeWithInfo(PyTime_t *t, _Py_clock_info_t *info) { @@ -1270,22 +1254,6 @@ PyTime_MonotonicRaw(PyTime_t *result) } -PyTime_t -_PyTime_MonotonicUnchecked(void) -{ - PyTime_t t; -#ifdef Py_DEBUG - int result = PyTime_MonotonicRaw(&t); - if (result != 0) { - Py_FatalError("unable to read the monotonic clock"); - } -#else - (void)PyTime_MonotonicRaw(&t); -#endif - return t; -} - - int _PyTime_MonotonicWithInfo(PyTime_t *tp, _Py_clock_info_t *info) { @@ -1314,13 +1282,6 @@ PyTime_PerfCounterRaw(PyTime_t *result) } -PyTime_t -_PyTime_PerfCounterUnchecked(void) -{ - return _PyTime_MonotonicUnchecked(); -} - - int _PyTime_localtime(time_t t, struct tm *tm) { @@ -1391,7 +1352,9 @@ _PyTime_gmtime(time_t t, struct tm *tm) PyTime_t _PyDeadline_Init(PyTime_t timeout) { - PyTime_t now = _PyTime_MonotonicUnchecked(); + PyTime_t now; + // silently ignore error: cannot report error to the caller + (void)PyTime_MonotonicRaw(&now); return _PyTime_Add(now, timeout); } @@ -1399,6 +1362,8 @@ _PyDeadline_Init(PyTime_t timeout) PyTime_t _PyDeadline_Get(PyTime_t deadline) { - PyTime_t now = _PyTime_MonotonicUnchecked(); + PyTime_t now; + // silently ignore error: cannot report error to the caller + (void)PyTime_MonotonicRaw(&now); return deadline - now; } |