From: David Goulet Date: Tue, 24 Jul 2012 17:37:10 +0000 (-0400) Subject: Fix: typo in time_diff() with nsec difference X-Git-Tag: v2.1.0-rc1~55 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=931a97e545601bbeeafc5b94729464a908ea1cd9;p=lttng-tools.git Fix: typo in time_diff() with nsec difference Signed-off-by: David Goulet --- 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;