From 931a97e545601bbeeafc5b94729464a908ea1cd9 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 24 Jul 2012 13:37:10 -0400 Subject: [PATCH] Fix: typo in time_diff() with nsec difference Signed-off-by: David Goulet --- src/bin/lttng-sessiond/health.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/lttng-sessiond/health.c b/src/bin/lttng-sessiond/health.c index 6c4de9430..7bf41c883 100644 --- a/src/bin/lttng-sessiond/health.c +++ b/src/bin/lttng-sessiond/health.c @@ -43,7 +43,7 @@ static void time_diff(const struct timespec *time_a, res->tv_nsec = 1000000000L + time_a->tv_sec - time_b->tv_sec; } else { res->tv_sec = time_a->tv_sec - time_b->tv_sec; - res->tv_nsec = time_a->tv_sec - time_b->tv_sec; + res->tv_nsec = time_a->tv_nsec - time_b->tv_nsec; } } @@ -84,7 +84,7 @@ int health_check_state(struct health_state *state) current = uatomic_read(&state->current); ret = clock_gettime(CLOCK_MONOTONIC, ¤t_time); - if (ret) { + if (ret < 0) { PERROR("Error reading time\n"); /* error */ retval = 0; -- 2.34.1