diff --git a/server/src/hooks.c b/server/src/hooks.c index b656eef25..4e7d9075b 100644 --- a/server/src/hooks.c +++ b/server/src/hooks.c @@ -254,7 +254,7 @@ int hook_skip_first(struct path *p, struct hook *h, int when) break; case HOOK_PATH_START: - clock_gettime(CLOCK_REALTIME, &private->started); + private->started = time_now(); break; case HOOK_POST: { diff --git a/server/src/log.c b/server/src/log.c index 984385cb5..f99a33e1e 100644 --- a/server/src/log.c +++ b/server/src/log.c @@ -56,7 +56,7 @@ void log_setlevel(int lvl) void log_init() { - clock_gettime(CLOCK_REALTIME, &epoch); + epoch = time_now(); debug(10, "Debug clock resetted"); } @@ -71,11 +71,10 @@ void log_print(const char *lvl, const char *fmt, ...) void log_vprint(const char *lvl, const char *fmt, va_list ap) { - struct timespec ts; + struct timespec ts = time_now(); char *buf = alloc(512); /* Timestamp */ - clock_gettime(CLOCK_REALTIME, &ts); strcatf(&buf, "%10.3f ", time_delta(&epoch, &ts)); /* Severity */ diff --git a/server/src/path.c b/server/src/path.c index 534d325c1..f68c5d9dc 100644 --- a/server/src/path.c +++ b/server/src/path.c @@ -35,7 +35,7 @@ static void path_write(struct path *p) debug(15, "Sent %u messages to node '%s'", sent, n->name); p->sent += sent; - clock_gettime(CLOCK_REALTIME, &p->ts_sent); + p->ts_sent = time_now(); /** @todo use hardware timestamps for socket node type */ } } @@ -93,8 +93,8 @@ static void * path_run(void *arg) continue; /** @todo Replace this timestamp by hardware timestamping */ - clock_gettime(CLOCK_REALTIME, &p->ts_recv); - + p->ts_recv = time_now(); + debug(15, "Received %u messages from node '%s'", recv, p->in->name); /* Run preprocessing hooks */ diff --git a/server/src/random.c b/server/src/random.c index c253592bc..4e9da6238 100644 --- a/server/src/random.c +++ b/server/src/random.c @@ -59,8 +59,7 @@ int main(int argc, char *argv[]) while (limit-- > 0 || argc < 4) { m.sequence += timerfd_wait(tfd); - struct timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); + struct timespec ts = time_now(); m.ts.sec = ts.tv_sec; m.ts.nsec = ts.tv_nsec; diff --git a/server/src/receive.c b/server/src/receive.c index d11a9716b..7e99756c2 100644 --- a/server/src/receive.c +++ b/server/src/receive.c @@ -113,8 +113,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "# %-20s\t\t%s\n", "sec.nsec+offset(seq)", "data[]"); for (;;) { - struct timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); + struct timespec ts = time_now(); int recv = node_read(node, pool, node->combine, 0, node->combine); for (int i = 0; i < recv; i++) {