summaryrefslogtreecommitdiff
path: root/ubx.c
diff options
context:
space:
mode:
authorChris Kuethe <chris.kuethe@gmail.com>2006-12-26 06:04:35 +0000
committerChris Kuethe <chris.kuethe@gmail.com>2006-12-26 06:04:35 +0000
commitba665244d0a7f9dcccb6ec88e59a5275ebde6d48 (patch)
tree8c0ce579fbffdf72b2d1d95a56b28aea117b19a9 /ubx.c
parent05b21262589143cbd4ac7db896ea229f13cd5d52 (diff)
downloadgpsd-ba665244d0a7f9dcccb6ec88e59a5275ebde6d48.tar.gz
Fix time parsing. Prompted by Ali Utku Selen in IRC
Diffstat (limited to 'ubx.c')
-rw-r--r--ubx.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/ubx.c b/ubx.c
index c6ac9106..5e377389 100644
--- a/ubx.c
+++ b/ubx.c
@@ -48,12 +48,9 @@ ubx_msg_nav_sol(struct gps_device_t *session, unsigned char *buf, size_t data_le
if (gw > gps_week)
gps_week = gw;
- t = gpstime_to_unix(gps_week, tow) - session->context->leap_seconds;
- if (t > session->gpsdata.online){
- session->gpsdata.online = t;
- session->gpsdata.sentence_time = t;
- session->gpsdata.fix.time = t;
- }
+ t = gpstime_to_unix(gps_week, tow/1000.0) - session->context->leap_seconds;
+ session->gpsdata.sentence_time = t;
+ session->gpsdata.fix.time = t;
mask |= TIME_SET | ONLINE_SET;
epx = (double)(getsl(buf, 12)/100.0);
@@ -121,12 +118,8 @@ ubx_msg_nav_timegps(struct gps_device_t *session, unsigned char *buf, size_t dat
if (flags & 0x7)
session->context->leap_seconds = getub(buf, 10);
- t = gpstime_to_unix(gps_week, tow) - session->context->leap_seconds;
- if (t > session->gpsdata.online){
- session->gpsdata.online = t;
- session->gpsdata.sentence_time = t;
- session->gpsdata.fix.time = t;
- }
+ t = gpstime_to_unix(gps_week, tow/1000.0) - session->context->leap_seconds;
+ session->gpsdata.sentence_time = session->gpsdata.fix.time = t;
return TIME_SET | ONLINE_SET;
}