summaryrefslogtreecommitdiff
path: root/driver_proto.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-10-26 19:05:15 -0700
committerGary E. Miller <gem@rellim.com>2018-10-26 19:05:15 -0700
commit084db394dfab4c734196544f961a09a0b22ea3c3 (patch)
tree930ec43d121a0944132b9e66e3114d9e7192e3ea /driver_proto.c
parent65f9daadd1d82e7ba77510e5f3a193bbe6d32606 (diff)
downloadgpsd-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 'driver_proto.c')
-rw-r--r--driver_proto.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/driver_proto.c b/driver_proto.c
index ac20fb8d..ccdf7f24 100644
--- a/driver_proto.c
+++ b/driver_proto.c
@@ -235,6 +235,7 @@ _proto__msg_raw(struct gps_device_t *session, unsigned char *buf, size_t data_le
{
unsigned char i, st, nchan, nsv;
unsigned int tow;
+ double t_intp;
if (data_len != RAW_MSG_LEN )
return 0;
@@ -260,7 +261,10 @@ _proto__msg_raw(struct gps_device_t *session, unsigned char *buf, size_t data_le
return 0;
}
- session->gpsdata.raw.mtime = session->newdata.time;
+ session->gpsdata.raw.mtime.tv_nsec =
+ modf(session->newdata.time, &t_intp) * 10e8;
+ session->gpsdata.raw.mtime.tv_sec = (time_t)t_intp;
+
/* this is so we can tell which never got set */
for (i = 0; i < MAXCHANNELS; i++)
session->gpsdata.raw.meas[i].svid = 0;