[libowlps] Use labs() for int_fast32_t

int_fast32_t is at least 32-bit wide, like long. Hence, labs() should be
used instead of abs().
master
Matteo Cypriani 7 years ago
parent 41640da203
commit c6e39f7e70

@ -321,7 +321,7 @@ void owl_time_elapsed(const owl_timestamp *const d1,
if (sec == 0)
{
elapsed->tv_sec = 0 ;
elapsed->tv_nsec = abs(nsec) ;
elapsed->tv_nsec = labs(nsec) ;
}
else if (sec > 0)
{
@ -340,13 +340,13 @@ void owl_time_elapsed(const owl_timestamp *const d1,
{
if (nsec > 0)
{
elapsed->tv_sec = abs(sec) - 1 ;
elapsed->tv_sec = labs(sec) - 1 ;
elapsed->tv_nsec = 1000000000ul - nsec ;
}
else // nsec <= 0
{
elapsed->tv_sec = abs(sec) ;
elapsed->tv_nsec = abs(nsec) ;
elapsed->tv_sec = labs(sec) ;
elapsed->tv_nsec = labs(nsec) ;
}
}
}

Loading…
Cancel
Save