The abs function takes a 32-bit int, which can cause truncation. Fixes
compilation error:
error: absolute value function 'abs' given an argu>
if ((sec < 0) || (abs(cur.tv_sec - tv.tv_sec) > MAX_TIME_OFFSET)) {
Signed-off-by: Rosen Penev <rosenp@gmail.com>
gettimeofday(&cur, NULL);
- if ((sec < 0) || (abs(cur.tv_sec - sec) > MAX_TIME_OFFSET)) {
+ if ((sec < 0) || (llabs(cur.tv_sec - sec) > MAX_TIME_OFFSET)) {
struct timeval tv = { 0 };
tv.tv_sec = sec;
if (++nmea_bad_time > MAX_BAD_TIME) {