[lib] timestamp_now_ns(): return int (not BOOL)

This commit is contained in:
Matteo Cypriani 2011-03-10 19:38:27 +01:00
parent cfdbdccca3
commit 2771f8573b
2 changed files with 7 additions and 6 deletions

View File

@ -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 ;
}

View File

@ -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) ;