-/**
- * Add two time values.
- *
- * \param a First addend.
- * \param b Second addend.
- * \param sum Contains the sum \a + \a b on return.
- */
-void tv_add(const struct timeval *a, const struct timeval *b,
- struct timeval *sum)
-{
- sum->tv_sec = a->tv_sec + b->tv_sec;
- if (a->tv_usec + b->tv_usec >= 1000 * 1000) {
- sum->tv_sec++;
- sum->tv_usec = a->tv_usec + b->tv_usec - 1000 * 1000;
- } else
- sum->tv_usec = a->tv_usec + b->tv_usec;
-}
-
-/**
- * Compute integer multiple of given struct timeval.
- *
- * \param mult The integer value to multiply with.
- * \param tv The timevalue to multiply.
- *
- * \param result Contains \a mult * \a tv on return.
- */
-void tv_scale(const unsigned long mult, const struct timeval *tv,
- struct timeval *result)
-{
- result->tv_sec = mult * tv->tv_sec;
- result->tv_sec += tv->tv_usec * mult / 1000 / 1000;
- result->tv_usec = tv->tv_usec * mult % (1000 * 1000);
-}
-
-/**
- * Compute a fraction of given struct timeval.
- *
- * \param divisor The integer value to divide by.
- * \param tv The timevalue to divide.
- * \param result Contains (1 / mult) * tv on return.
- */
-void tv_divide(const unsigned long divisor, const struct timeval *tv,
- struct timeval *result)
-{
- uint64_t x = ((uint64_t)tv->tv_sec * 1000 * 1000 + tv->tv_usec) / divisor;
-
- result->tv_sec = x / 1000 / 1000;
- result->tv_usec = x % (1000 * 1000);
-}
-