Lines Matching refs:round
248 double rounded = round(x);
250 /* halfway case: round to even */
251 rounded = 2.0 * round(x / 2.0);
258 pytime_round(double x, _PyTime_round_t round)
264 if (round == _PyTime_ROUND_HALF_EVEN) {
267 else if (round == _PyTime_ROUND_CEILING) {
270 else if (round == _PyTime_ROUND_FLOOR) {
274 assert(round == _PyTime_ROUND_UP);
283 long idenominator, _PyTime_round_t round)
293 floatpart = pytime_round(floatpart, round);
331 long denominator, _PyTime_round_t round)
343 denominator, round);
357 _PyTime_ObjectToTime_t(PyObject *obj, time_t *sec, _PyTime_round_t round)
370 d = pytime_round(d, round);
393 _PyTime_round_t round)
395 return pytime_object_to_denominator(obj, sec, nsec, SEC_TO_NS, round);
401 _PyTime_round_t round)
403 return pytime_object_to_denominator(obj, sec, usec, SEC_TO_US, round);
521 pytime_from_double(_PyTime_t *tp, double value, _PyTime_round_t round,
530 d = pytime_round(d, round);
545 pytime_from_object(_PyTime_t *tp, PyObject *obj, _PyTime_round_t round,
555 return pytime_from_double(tp, d, round, unit_to_ns);
581 _PyTime_FromSecondsObject(_PyTime_t *tp, PyObject *obj, _PyTime_round_t round)
583 return pytime_from_object(tp, obj, round, SEC_TO_NS);
588 _PyTime_FromMillisecondsObject(_PyTime_t *tp, PyObject *obj, _PyTime_round_t round)
590 return pytime_from_object(tp, obj, round, MS_TO_NS);
652 const _PyTime_round_t round)
655 if (round == _PyTime_ROUND_HALF_EVEN) {
669 else if (round == _PyTime_ROUND_CEILING) {
677 else if (round == _PyTime_ROUND_FLOOR){
686 assert(round == _PyTime_ROUND_UP);
729 _PyTime_As100Nanoseconds(_PyTime_t t, _PyTime_round_t round)
732 return pytime_divide(ns, NS_TO_100NS, round);
738 _PyTime_AsMicroseconds(_PyTime_t t, _PyTime_round_t round)
741 return pytime_divide(ns, NS_TO_US, round);
746 _PyTime_AsMilliseconds(_PyTime_t t, _PyTime_round_t round)
749 return pytime_divide(ns, NS_TO_MS, round);
755 _PyTime_round_t round)
758 _PyTime_t us = pytime_divide(ns, US_TO_NS, round);
770 _PyTime_round_t round, int raise_exc)
774 int res = pytime_as_timeval(t, &tv_sec, &tv_usec, round);
796 _PyTime_AsTimeval(_PyTime_t t, struct timeval *tv, _PyTime_round_t round)
798 return pytime_as_timeval_struct(t, tv, round, 1);
803 _PyTime_AsTimeval_clamp(_PyTime_t t, struct timeval *tv, _PyTime_round_t round)
805 (void)pytime_as_timeval_struct(t, tv, round, 0);
811 _PyTime_round_t round)
814 if (pytime_as_timeval(t, &secs, us, round) < 0) {