diff options
Diffstat (limited to 'Include/pytime.h')
-rw-r--r-- | Include/pytime.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Include/pytime.h b/Include/pytime.h index 027c3d803a..41fb80607d 100644 --- a/Include/pytime.h +++ b/Include/pytime.h @@ -30,7 +30,10 @@ typedef enum { _PyTime_ROUND_FLOOR=0, /* Round towards infinity (+inf). For example, used for timeout to wait "at least" N seconds. */ - _PyTime_ROUND_CEILING + _PyTime_ROUND_CEILING=1, + /* Round to nearest with ties going away from zero. + For example, used to round from a Python float. */ + _PyTime_ROUND_HALF_UP } _PyTime_round_t; /* Convert a time_t to a PyLong. */ @@ -41,6 +44,10 @@ PyAPI_FUNC(PyObject *) _PyLong_FromTime_t( PyAPI_FUNC(time_t) _PyLong_AsTime_t( PyObject *obj); +/* Round to nearest with ties going away from zero (_PyTime_ROUND_HALF_UP). */ +PyAPI_FUNC(double) _PyTime_RoundHalfUp( + double x); + /* Convert a number of seconds, int or float, to time_t. */ PyAPI_FUNC(int) _PyTime_ObjectToTime_t( PyObject *obj, |