Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions dump1090.c
Original file line number Diff line number Diff line change
Expand Up @@ -2507,6 +2507,7 @@ char *aircraftsToJson(int *len) {
int buflen = 1024; /* The initial buffer is incremented as needed. */
char *buf = malloc(buflen), *p = buf;
int l;
time_t now = time(NULL);

l = snprintf(p,buflen,"[\n");
p += l; buflen -= l;
Expand All @@ -2523,9 +2524,9 @@ char *aircraftsToJson(int *len) {
l = snprintf(p,buflen,
"{\"hex\":\"%s\", \"flight\":\"%s\", \"lat\":%f, "
"\"lon\":%f, \"altitude\":%d, \"track\":%d, "
"\"speed\":%d},\n",
"\"speed\":%d, \"messages\":%ld, \"seen\":%d},\n",
a->hexaddr, a->flight, a->lat, a->lon, altitude, a->track,
speed);
speed, a->messages, (int)(now - a->seen));
p += l; buflen -= l;
/* Resize if needed. */
if (buflen < 256) {
Expand Down
Loading