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;
}
}
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;
}
end:
- DBG("Health state current %" PRIu64 ", last %" PRIu64 ", ret %d",
+ DBG("Health state current %lu, last %lu, ret %d",
current, last, ret);
return retval;