[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gpsd-dev] [PATCH 2/3] Process fractional part of TOW
From: |
Clark Li |
Subject: |
[gpsd-dev] [PATCH 2/3] Process fractional part of TOW |
Date: |
Sun, 17 Sep 2017 04:02:13 +0000 |
Update test/dae/ublox-aek-4t.log.chk accordingly
---
driver_ubx.c | 12 ++++++++----
test/daemon/ublox-aek-4t.log.chk | 2 +-
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/driver_ubx.c b/driver_ubx.c
index e0055af..51ad299 100644
--- a/driver_ubx.c
+++ b/driver_ubx.c
@@ -166,10 +166,14 @@ ubx_msg_nav_sol(struct gps_device_t *session, unsigned
char *buf,
#define DATE_VALID (UBX_SOL_VALID_WEEK | UBX_SOL_VALID_TIME)
if ((flags & DATE_VALID) == DATE_VALID) {
unsigned short gw;
- unsigned int tow;
- tow = (unsigned int)getleu32(buf, 0);
+ unsigned int iTOW;
+ int fTOW;
+ iTOW = (unsigned int)getleu32(buf, 0);
+ fTOW = (int)getles32(buf, 4);
gw = (unsigned short)getles16(buf, 8);
- session->newdata.time = gpsd_gpstime_resolve(session, gw, tow / 1000.0);
+ session->newdata.time = gpsd_gpstime_resolve(session, gw,
+ (iTOW * 1e-3)
+ + (fTOW * 1e-9));
mask |= TIME_SET | NTPTIME_IS;
}
#undef DATE_VALID
@@ -314,7 +318,7 @@ ubx_msg_nav_timegps(struct gps_device_t *session, unsigned
char *buf,
session->newdata.time =
gpsd_gpstime_resolve(session,
(unsigned short int)gw,
- ((double)iTOW * 1e-3));
+ ((double)iTOW * 1e-3) + ((double)fTOW * 1e-9));
mask |= (TIME_SET | NTPTIME_IS);
}
diff --git a/test/daemon/ublox-aek-4t.log.chk b/test/daemon/ublox-aek-4t.log.chk
index 45680ea..31acd97 100644
--- a/test/daemon/ublox-aek-4t.log.chk
+++ b/test/daemon/ublox-aek-4t.log.chk
@@ -26,4 +26,4 @@ $GPZDA,231127.00,23,12,2007,00,00*65
$GPGGA,231126,2037.7569,N,08704.0845,W,2,07,1.67,75.75,M,-13.865,M,,*4C
$GPRMC,231126,A,2037.7569,N,08704.0845,W,0.0000,0.000,231207,,*36
$GPGSA,A,3,15,2,30,5,12,18,135,,,,,,2.6,1.7,2.0*0F
-{"class":"TPV","status":2,"mode":3,"time":"2007-12-23T23:11:26.999Z","ept":0.005,"lat":20.629281718,"lon":-87.068075424,"alt":75.754,"epx":2.973,"epy":6.138,"epv":11.443,"track":0.0000,"speed":0.000,"climb":0.000,"eps":0.17,"epc":22.89}
+{"class":"TPV","status":2,"mode":3,"time":"2007-12-23T23:11:26.999Z","ept":0.005,"lat":20.629281718,"lon":-87.068075424,"alt":75.754,"epx":2.973,"epy":6.138,"epv":11.443,"track":0.0000,"speed":0.000,"climb":0.000,"eps":0.17,"epc":22.88}
--
2.7.4