]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/util: remove unused function
authorVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 27 Sep 2021 07:36:30 +0000 (09:36 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Wed, 3 Nov 2021 14:42:47 +0000 (15:42 +0100)
The POSIX APIs using `struct timeval` are deprecated anyway
in favor of clock_gettime() + `struct timespec`.

The function didn't seem well designed anyway, as `long` is just
32-bit on usual 32-bit platforms, which certainly isn't safe.
(roughly one month, on a quick glance)

lib/utils.h

index b372d5f001ed60bf69e917466e32179b9478cc75..83674efa8b1a6852fd0bb9e27ad167bfa7f1bdd4 100644 (file)
@@ -113,21 +113,6 @@ static inline int strcmp_p(const void *p1, const void *p2)
        return strcmp(*(char * const *)p1, *(char * const *)p2);
 }
 
-
-/** Return time difference in miliseconds.
-  * @note based on the _BSD_SOURCE timersub() macro */
-static inline long time_diff(struct timeval *begin, struct timeval *end) {
-    struct timeval res = {
-        .tv_sec = end->tv_sec - begin->tv_sec,
-        .tv_usec = end->tv_usec - begin->tv_usec
-    };
-    if (res.tv_usec < 0) {
-        --res.tv_sec;
-        res.tv_usec += 1000000;
-    }
-    return res.tv_sec * 1000 + res.tv_usec / 1000;
-}
-
 /** Get current working directory with fallback value. */
 static inline void get_workdir(char *out, size_t len) {
        if(getcwd(out, len) == NULL) {