diff options
author | Gary E. Miller <gem@rellim.com> | 2018-10-26 19:05:15 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2018-10-26 19:05:15 -0700 |
commit | 084db394dfab4c734196544f961a09a0b22ea3c3 (patch) | |
tree | 930ec43d121a0944132b9e66e3114d9e7192e3ea /gpsd_json.c | |
parent | 65f9daadd1d82e7ba77510e5f3a193bbe6d32606 (diff) | |
download | gpsd-084db394dfab4c734196544f961a09a0b22ea3c3.tar.gz |
rawdata_t: convert mtime from timestamp_t to timespec_t.
One ns is important when measuring distance using time.
Diffstat (limited to 'gpsd_json.c')
-rw-r--r-- | gpsd_json.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gpsd_json.c b/gpsd_json.c index 198645e0..5f4f531c 100644 --- a/gpsd_json.c +++ b/gpsd_json.c @@ -725,14 +725,15 @@ void json_raw_dump(const struct gps_data_t *gpsdata, int i; assert(replylen > sizeof(char *)); - if (0 == isfinite(gpsdata->raw.mtime)) { + if (0 == gpsdata->raw.mtime.tv_sec) { /* no data to dump */ return; } (void)strlcpy(reply, "{\"class\":\"RAW\",", replylen); if (gpsdata->dev.path[0] != '\0') - str_appendf(reply, replylen, "\"device\":\"%s\",\"time\":%f,", - gpsdata->dev.path, gpsdata->raw.mtime); + str_appendf(reply, replylen, "\"device\":\"%s\",\"time\":%ld.%09ld,", + gpsdata->dev.path, (long)gpsdata->raw.mtime.tv_sec, + gpsdata->raw.mtime.tv_nsec); (void)strlcat(reply, "\"rawdata\":[", replylen); for (i = 0; i < MAXCHANNELS; i++) { |