]> git.tuebingen.mpg.de Git - dss.git/commitdiff
tv.c: Remove unused functions.
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 3 Jan 2015 16:11:06 +0000 (16:11 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 6 Jan 2015 19:55:32 +0000 (20:55 +0100)
Quite a few public functions of tv.c are not used anywhere in dss,
so let's get rid of them. We can easily add them back in case they
are neeed in the future.

Found by cppcheck.

tv.c
tv.h

diff --git a/tv.c b/tv.c
index 5beca9d0d36ab83f06e22f55b0d8a920270e994a..8ab5e5a90a6bd151c87750adb761c135b7ec774e 100644 (file)
--- a/tv.c
+++ b/tv.c
 #include "log.h"
 #include "time.h"
 
-/**
- * Convert struct timeval to milliseconds.
- *
- * \param tv The time value value to convert.
- *
- * \return The number off milliseconds in \a tv.
- */
-long unsigned tv2ms(const struct timeval *tv)
-{
-       return tv->tv_sec * 1000 + (tv->tv_usec + 500)/ 1000;
-}
-
-/**
- * Convert milliseconds to a struct timeval.
- *
- * \param n The number of milliseconds.
- * \param tv Result pointer.
- */
-void ms2tv(long unsigned n, struct timeval *tv)
-{
-       tv->tv_sec = n / 1000;
-       tv->tv_usec = (n % 1000) * 1000;
-}
-
-/**
- * Convert a double to a struct timeval.
- *
- * \param x The value to convert.
- * \param tv Result pointer.
- */
-void d2tv(double x, struct timeval *tv)
-{
-       tv->tv_sec = x;
-       tv->tv_usec = (x - (double)tv->tv_sec) * 1000.0 * 1000.0 + 0.5;
-}
-
 /**
  * Compute the difference of two time values.
  *
@@ -86,56 +50,6 @@ int tv_diff(const struct timeval *b, const struct timeval *a, struct timeval *di
        return ret;
 }
 
-/**
- * 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);
-}
-
 int64_t get_current_time(void)
 {
        time_t now;
diff --git a/tv.h b/tv.h
index f2021e0834591de533598fe486639cbfa95a4b81..c61a848a81aa568aa54a9546c2ebf515623ab58b 100644 (file)
--- a/tv.h
+++ b/tv.h
@@ -1,9 +1,2 @@
 int tv_diff(const struct timeval *b, const struct timeval *a, struct timeval *diff);
-long unsigned tv2ms(const struct timeval*);
-void d2tv(double, struct timeval*);
-void tv_add(const struct timeval*, const struct timeval *, struct timeval *);
-void tv_scale(const unsigned long, const struct timeval *, struct timeval *);
-void tv_divide(const unsigned long divisor, const struct timeval *tv,
-       struct timeval *result);
-void ms2tv(const long unsigned n, struct timeval *tv);
 int64_t get_current_time(void);