Found by Coverity:
CID
1311498 (#1 of 1): Unchecked return value (CHECKED_RETURN)1.
check_return: Calling clock_gettime without checking return value (as is
done elsewhere 8 out of 9 times).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
{
struct timespec ts;
- clock_gettime(CLOCK_MONOTONIC, &ts);
+ if (clock_gettime(CLOCK_MONOTONIC, &ts)) {
+ /* TODO Report error cleanly up the chain. */
+ PERROR("clock_gettime CLOCK_MONOTONIC");
+ ts.tv_sec = 0;
+ ts.tv_nsec = 0;
+ }
return ((uint64_t) ts.tv_sec * 1000000000ULL) + ts.tv_nsec;
}