diff --git a/libowlps/libowlps.c b/libowlps/libowlps.c index b859ecb..2886fc5 100644 --- a/libowlps/libowlps.c +++ b/libowlps/libowlps.c @@ -95,7 +95,7 @@ uint_fast8_t frequency_to_channel(uint_fast16_t channel) */ void timestamp_now(TIMESTAMP *now) { - if (timestamp_now_ns(now)) + if (! timestamp_now_ns(now)) timestamp_round_to_ms(now) ; } @@ -104,14 +104,15 @@ void timestamp_now(TIMESTAMP *now) /* * Set the TIMESTAMP 'now' at the current time (nanosecond-precision). */ -BOOL timestamp_now_ns(TIMESTAMP *now) +int timestamp_now_ns(TIMESTAMP *now) { - if (clock_gettime(CLOCK_REALTIME, now)) + int ret ; + if ((ret = clock_gettime(CLOCK_REALTIME, now))) { perror("Cannot get the current time") ; - return FALSE ; + return ret ; } - return TRUE ; + return 0 ; } diff --git a/libowlps/owlps.h b/libowlps/owlps.h index e1cc831..85c6d18 100644 --- a/libowlps/owlps.h +++ b/libowlps/owlps.h @@ -224,7 +224,7 @@ uint_fast8_t frequency_to_channel(uint_fast16_t channel) ; // Time void timestamp_now(TIMESTAMP *now) ; -BOOL timestamp_now_ns(TIMESTAMP *now) ; +int timestamp_now_ns(TIMESTAMP *now) ; void timestamp_round_to_ms(TIMESTAMP *now) ; TIMESTAMP timeval_to_timestamp(const struct timeval d) ; uint64_t timestamp_to_ms(TIMESTAMP date) ;