gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] [PATCH] Process fractional part of TOW


From: Clark Li
Subject: [gpsd-dev] [PATCH] Process fractional part of TOW
Date: Thu, 21 Sep 2017 02:25:23 +0000

Update test/dae/ublox-aek-4t.log.chk accordingly.

NOTE: This patch needs to be applied with git am --ignore-whitespace
---
 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 05edc59..7967441 100644
--- a/driver_ubx.c
+++ b/driver_ubx.c
@@ -276,10 +276,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
@@ -424,7 +428,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..c65e12b 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]