From 0c3bb23eb447d4ae47c7013346fa6fa97482bb1d Mon Sep 17 00:00:00 2001 From: antirez Date: Sun, 21 Jan 2024 10:54:50 +0100 Subject: [PATCH] Fix json when metric units are set. --- dump1090.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dump1090.c b/dump1090.c index 86ce77d..ed9b2bf 100644 --- a/dump1090.c +++ b/dump1090.c @@ -1807,7 +1807,7 @@ struct aircraft *interactiveReceiveData(struct modesMessage *mm) { } /* If the two data is less than 10 seconds apart, compute * the position. */ - if (abs(a->even_cprtime - a->odd_cprtime) <= 10000) { + if (llabs(a->even_cprtime - a->odd_cprtime) <= 10000) { decodeCPR(a); } } else if (mm->metype == 19) { @@ -2181,8 +2181,8 @@ char *aircraftsToJson(int *len) { "{\"hex\":\"%s\", \"flight\":\"%s\", \"lat\":%f, " "\"lon\":%f, \"altitude\":%d, \"track\":%d, " "\"speed\":%d},\n", - a->hexaddr, a->flight, a->lat, a->lon, a->altitude, a->track, - a->speed); + a->hexaddr, a->flight, a->lat, a->lon, altitude, a->track, + speed); p += l; buflen -= l; /* Resize if needed. */ if (buflen < 256) {