diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-28 00:26:47 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-28 00:26:47 (GMT) |
commit | 95e9cef6f023a1cf365f2f02775badb3a6ac0d82 (patch) | |
tree | 721cb2ab9fbba707888bc7e90b49758ffd5156ed /Include/pytime.h | |
parent | b7df3144ef14ec50650dfd47da4ba09ee0bc674c (diff) | |
download | cpython-95e9cef6f023a1cf365f2f02775badb3a6ac0d82.zip cpython-95e9cef6f023a1cf365f2f02775badb3a6ac0d82.tar.gz cpython-95e9cef6f023a1cf365f2f02775badb3a6ac0d82.tar.bz2 |
Issue #22117: Write unit tests for _PyTime_AsTimeval()
* _PyTime_AsTimeval() now ensures that tv_usec is always positive
* _PyTime_AsTimespec() now ensures that tv_nsec is always positive
* _PyTime_AsTimeval() now returns an integer on overflow instead of raising an
exception
Diffstat (limited to 'Include/pytime.h')
-rw-r--r-- | Include/pytime.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Include/pytime.h b/Include/pytime.h index 17d5ea1..72b6460 100644 --- a/Include/pytime.h +++ b/Include/pytime.h @@ -140,13 +140,15 @@ PyAPI_FUNC(_PyTime_t) _PyTime_AsMilliseconds(_PyTime_t t, PyAPI_FUNC(PyObject *) _PyTime_AsNanosecondsObject(_PyTime_t t); /* Convert a timestamp to a timeval structure (microsecond resolution). - Raise an exception and return -1 on error, return 0 on success. */ + tv_usec is always positive. + Return -1 if the conversion overflowed, return 0 on success. */ PyAPI_FUNC(int) _PyTime_AsTimeval(_PyTime_t t, struct timeval *tv, _PyTime_round_t round); #ifdef HAVE_CLOCK_GETTIME /* Convert a timestamp to a timespec structure (nanosecond resolution). + tv_nsec is always positive. Raise an exception and return -1 on error, return 0 on success. */ PyAPI_FUNC(int) _PyTime_AsTimespec(_PyTime_t t, struct timespec *ts); #endif |