gpsd-users
[Top][All Lists]
Advanced

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

Re: [gpsd-users] TOFF and PPS values from gpspipe


From: Kaya Saman
Subject: Re: [gpsd-users] TOFF and PPS values from gpspipe
Date: Wed, 28 Aug 2019 21:35:46 +0100
User-agent: Mozilla/5.0 (X11; Linux aarch64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

Yo Gary!

On 8/28/19 7:19 PM, Gary E. Miller wrote:
Yo Kaya!

On Tue, 27 Aug 2019 21:28:49 +0100
Kaya Saman <address@hidden> wrote:

I'm writing a script in order to be able to display certain
information from GPSd on a 20x2 line character LCD display.
Did you look at lcdgps.c in the gpsd source?  That is exactly what
it already does.


Yep I did. The only issue is that it requires LCDproc of which there isn't a driver for my Newhaven display :-( <- my idea was to write a driver for it but have no experience there so it's basically another story lol


Basically what I want to figure out is how gpsmon arrives at the TOFF
and PPS values in the GSA + PPS window. Is there a formula for it?
Read the gpsd_json man page for details.


Ok.... https://manpages.debian.org/jessie/libgps-dev/gpsd_json.5.en.html


so I think what I'm after is this (though I maybe confusing like crazy here...):

for TOFF it's basically the difference between the clock_sec and real_sec values with the PPS offset being the real_nsec and clock_nsec values??


Taking the example from the docs:

https://gpsd.gitlab.io/gpsd/gpsd_json.html

{"class":"PPS","device":"/dev/ttyUSB0",
       "real_sec":1330212592, "real_nsec":343182,
       "clock_sec":1330212592,"clock_nsec":343184,
       "precision":-3}

while in gpsmon it shows the PPS as -0.00000xxxx <- where 'xxxx'
changes on each pulse.
Yes, it is just the difference between when we think the PPS was sent
and the system clock at that moment.


I've also had a look at the gpsmon.c file:
https://github.com/mutability/gpsd/blob/master/gpsmon.c
but couldn't find anything....
The code is in toff_update() in gpsmon.c

         TS_SUB(&timedelta, &time_offset.clock, &time_offset.real);


Ok yep:


    TS_SUB(&timedelta, &time_offset.clock, &time_offset.real);
    if ( 86400 < (long)labs(timedelta.tv_sec) ) {
        /* more than one day off, overflow */
        /* need a bigger field to show it */
        (void)mvwaddstr(win, y, x, "> 1 day");
    } else {
        char buf[TIMESPEC_LEN];
        timespec_str(&timedelta, buf, sizeof(buf));
        (void)mvwaddstr(win, y, x, buf);
    }
    }
}


So if it's simply the difference between time values using the information output by my system:


TOFF: 0.678304699

PPS: 0.000018192


In the PPS class output from gpspipe -wpP I get these values:


real_sec=1567023609 real_nsec=0

clock_sec=15670223609 clock_nsec=25649 precision=-20


At this stage now I am totally lost :-( Am I even looking at the right values needed to get the TOFF and PPS in the first place?


As my script is being written in Bash my idea was to simply use 'gpspipe' then using string manipulation do the numerical processing after obtaining the values needed.


If we look at the difference between the clock and real_sec values:

15670223609 - 1567023609 = 14103200000 seconds


...... and now I'm confused??


Regards,


Kaya


RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
     "If you can't measure it, you can't improve it." - Lord Kelvin



reply via email to

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