diff options
-rw-r--r-- | driver_evermore.c | 12 | ||||
-rw-r--r-- | driver_navcom.c | 5 | ||||
-rw-r--r-- | driver_sirf.c | 4 | ||||
-rw-r--r-- | driver_tsip.c | 4 | ||||
-rw-r--r-- | driver_zodiac.c | 1 | ||||
-rw-r--r-- | gpsd.h-tail | 1 | ||||
-rw-r--r-- | monitor_ubx.c | 2 |
7 files changed, 22 insertions, 7 deletions
diff --git a/driver_evermore.c b/driver_evermore.c index b775891c..1f8b705b 100644 --- a/driver_evermore.c +++ b/driver_evermore.c @@ -183,9 +183,10 @@ gps_mask_t evermore_parse(struct gps_device_t * session, unsigned char *buf, switch (type) { case 0x02: /* Navigation Data Output */ + session->context->gps_week = getleuw(buf2, 2); /*@ ignore @*//*@ splint is confused @ */ session->newdata.time = - gpstime_to_unix((int)getleuw(buf2, 2), + gpstime_to_unix(session->context->gps_week, getleul(buf2, 4) * 0.01) - session->context->leap_seconds; @@ -222,9 +223,10 @@ gps_mask_t evermore_parse(struct gps_device_t * session, unsigned char *buf, return mask | CLEAR_IS | REPORT_IS; case 0x04: /* DOP Data Output */ + session->context->gps_week = getleuw(buf2, 2); /*@ ignore @*//*@ splint is confused @ */ session->newdata.time = - gpstime_to_unix((int)getleuw(buf2, 2), + gpstime_to_unix(session->context->gps_week, getleul(buf2, 4) * 0.01) - session->context->leap_seconds; @@ -265,9 +267,10 @@ gps_mask_t evermore_parse(struct gps_device_t * session, unsigned char *buf, return mask; case 0x06: /* Channel Status Output */ + session->context->gps_week = getleuw(buf2, 2); /*@ ignore @*//*@ splint is confused @ */ session->gpsdata.skyview_time = - gpstime_to_unix((int)getleuw(buf2, 2), + gpstime_to_unix(session->context->gps_week, getleul(buf2, 4) * 0.01) - session->context->leap_seconds; @@ -324,9 +327,10 @@ gps_mask_t evermore_parse(struct gps_device_t * session, unsigned char *buf, case 0x08: /* Measurement Data Output */ /* clock offset is a manufacturer diagnostic */ /* (int)getleuw(buf2, 8); clock offset, 29000..29850 ?? */ + session->context->gps_week = getleuw(buf2, 2); /*@ ignore @*//*@ splint is confused @ */ session->newdata.time = - gpstime_to_unix((int)getleuw(buf2, 2), + gpstime_to_unix(session->context->gps_week, getleul(buf2, 4) * 0.01) - session->context->leap_seconds; diff --git a/driver_navcom.c b/driver_navcom.c index f20e7086..9fb75624 100644 --- a/driver_navcom.c +++ b/driver_navcom.c @@ -414,6 +414,7 @@ static gps_mask_t handle_0xb1(struct gps_device_t *session) /* Timestamp */ week = (uint16_t) getleuw(buf, 3); + session->context->gps_week = week; tow = (uint32_t) getleul(buf, 5); session->newdata.time = gpstime_to_unix((int)week, @@ -654,6 +655,7 @@ static gps_mask_t handle_0x81(struct gps_device_t *session) 4) | (getub(buf, 82) & 80 ? 0xc000 : 0x0000)); /*@ +predboolothers @*/ char time_str[24]; + session->context->gps_week = wn; (void)unix_to_iso8601(gpstime_to_unix((int)wn, (double)(toc * SF_TOC)), time_str, sizeof(time_str)); @@ -734,6 +736,7 @@ static gps_mask_t handle_0x86(struct gps_device_t *session) //uint8_t pdop = getub(buf, 15); /* Timestamp and PDOP */ + session->context->gps_week = week; /*@ ignore @*//*@ splint is confused @ */ session->gpsdata.skyview_time = gpstime_to_unix((int)week, @@ -835,6 +838,7 @@ static gps_mask_t handle_0xb0(struct gps_device_t *session) uint8_t status = getub(buf, 10); char time_str[24]; + session->context->gps_week = week; (void)unix_to_iso8601(gpstime_to_unix((int)week, (double)tow / 1000.0), time_str, sizeof(time_str)); @@ -927,6 +931,7 @@ static gps_mask_t handle_0xb5(struct gps_device_t *session) session->newdata.epv = alt_sd * 1.96; mask |= (HERR_IS | VERR_IS); #endif /* __UNUSED__ */ + session->context->gps_week = week; /*@ ignore @*//*@ splint is confused @ */ session->newdata.time = gpstime_to_unix((int)week, diff --git a/driver_sirf.c b/driver_sirf.c index f8013262..6d426ab1 100644 --- a/driver_sirf.c +++ b/driver_sirf.c @@ -470,10 +470,11 @@ static gps_mask_t sirf_msg_svinfo(struct gps_device_t *session, return 0; gpsd_zero_satellites(&session->gpsdata); + session->context->gps_week = getbesw(buf, 1); /*@ ignore @*//*@ splint is confused @ */ session->gpsdata.skyview_time = - gpstime_to_unix(getbesw(buf, 1), + gpstime_to_unix( session->context->gps_week, getbeul(buf, 3) * 1e-2) - session->context->leap_seconds; /*@ end @*/ @@ -612,6 +613,7 @@ static gps_mask_t sirf_msg_navsol(struct gps_device_t *session, navtype, session->gpsdata.status, session->newdata.mode); /* byte 20 is HDOP, see below */ /* byte 21 is "mode 2", not clear how to interpret that */ + session->context->gps_week = getbesw(buf, 22); /*@ ignore @*//*@ splint is confused @ */ session->newdata.time = gpstime_to_unix(getbesw(buf, 22), getbeul(buf, 24) * 1e-2) - diff --git a/driver_tsip.c b/driver_tsip.c index d080f651..9d4109d0 100644 --- a/driver_tsip.c +++ b/driver_tsip.c @@ -689,9 +689,10 @@ static gps_mask_t tsip_analyze(struct gps_device_t *session) session->context->leap_seconds = (int)u1; session->context->valid |= LEAP_SECOND_VALID; } + session->context->gps_week = s1; /*@ ignore @*//*@ splint is confused @ */ session->newdata.time = - gpstime_to_unix((int)s1, + gpstime_to_unix(session->context->gps_week, ul1 * 1e-3) - session->context->leap_seconds; /*@ end @*/ session->gpsdata.status = STATUS_NO_FIX; @@ -756,6 +757,7 @@ static gps_mask_t tsip_analyze(struct gps_device_t *session) session->context->leap_seconds = (int)s2; session->context->valid |= LEAP_SECOND_VALID; + session->context->gps_week = s1; session->newdata.time = gpstime_to_unix((int)s1, (double)ul1) - (double)s2; mask |= TIME_IS; diff --git a/driver_zodiac.c b/driver_zodiac.c index 238c3f09..58537dc1 100644 --- a/driver_zodiac.c +++ b/driver_zodiac.c @@ -240,6 +240,7 @@ static gps_mask_t handle1002(struct gps_device_t *session) break; } } + session->context->gps_week = gps_week; session->gpsdata.skyview_time = gpstime_to_unix(gps_week, (double)gps_seconds); gpsd_report(LOG_DATA, "1002: visible=%d used=%d mask={SATELLITE|USED}\n", diff --git a/gpsd.h-tail b/gpsd.h-tail index 101272ab..fb5d7fd3 100644 --- a/gpsd.h-tail +++ b/gpsd.h-tail @@ -167,6 +167,7 @@ struct gps_context_t { /* timekeeping */ int leap_seconds; /* Unix seconds to UTC */ unsigned short gps_week; /* GPS week, actually 10 bits */ + double gps_tow; /* GPS time of week, actually 19 bits */ int century; /* for NMEA-only devices without ZDA */ #ifdef NTPSHM_ENABLE bool enable_ntpshm; diff --git a/monitor_ubx.c b/monitor_ubx.c index 1d461228..0689127e 100644 --- a/monitor_ubx.c +++ b/monitor_ubx.c @@ -141,7 +141,7 @@ static void display_nav_sol(unsigned char *buf, size_t data_len) if ((flags & (UBX_SOL_VALID_WEEK | UBX_SOL_VALID_TIME)) != 0) { tow = (unsigned int)getleul(buf, 0); gw = (unsigned short)getlesw(buf, 8); - t = gpstime_to_unix((int)gw, tow / 1000.0); + t = gpstime_to_unix(gw, tow / 1000.0); tt = (time_t) trunc(t); } |