Fix json when metric units are set.

This commit is contained in:
antirez 2024-01-21 10:54:50 +01:00
parent 5579c4afe2
commit 0c3bb23eb4

View File

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