timeval_func: move all timeval manipulation to separate file

There are several definitions of the same functions manipulating timeval
structures. Let's move them to separate file and arrange the code
preperly.

Signed-off-by: Vadim Fedorenko <vadfed@meta.com>
This commit is contained in:
Vadim Fedorenko
2023-04-26 03:23:41 -07:00
parent 648ad4db6f
commit a197aac2f6
10 changed files with 182 additions and 193 deletions
+1 -16
View File
@@ -51,6 +51,7 @@
#include "testcode/testpkts.h"
#include "testcode/fake_event.h"
#include "sldns/str2wire.h"
#include "util/timeval_func.h"
/** max length of lines in file */
#define MAX_LINE_LEN 10240
@@ -66,22 +67,6 @@
static char* macro_expand(rbtree_type* store,
struct replay_runtime* runtime, char** text);
/** compare of time values */
static int
timeval_smaller(const struct timeval* x, const struct timeval* y)
{
#ifndef S_SPLINT_S
if(x->tv_sec < y->tv_sec)
return 1;
else if(x->tv_sec == y->tv_sec) {
if(x->tv_usec <= y->tv_usec)
return 1;
else return 0;
}
else return 0;
#endif
}
/** parse keyword in string.
* @param line: if found, the line is advanced to after the keyword.
* @param keyword: string.