gpsd-users
[Top][All Lists]
Advanced

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

Re: [gpsd-users] Shared Memory: PPS timestamps not set?


From: Guido Gavilanes
Subject: Re: [gpsd-users] Shared Memory: PPS timestamps not set?
Date: Thu, 4 Jul 2019 18:10:09 +0200


Thank you Gary,


I attached the code in my first email, I copy it at the bottom of this email. (this is program only to reproduce the problem).
I guess I am missing something regarding shm export since ntpshm seems more complex than this program. I will check that.
Thanks.
Guido

#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <errno.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>

#include "gps.h"

void main(void)
{
        int ret;
        struct gps_data_t gps_data;

      //  ret = gps_open("127.0.0.1","2947", &gps_data);
ret = gps_open(GPSD_SHARED_MEMORY,NULL, &gps_data);
        (void)gps_stream(&gps_data, WATCH_ENABLE | WATCH_JSON|WATCH_PPS, NULL);

double time_spent = 0.0;
clock_t begin = clock();
clock_t end;

        for (;;) {
end = clock();
begin = clock();
                        errno = 0;
                        if (gps_read(&gps_data) == -1) {
                                printf("Read error\n");
                                exit(1);
                        } else {
                                if (gps_data.set) {
                                        printf("\n--- GNSS - last sample elapsed time: %f %" PRIu64 "\n",(double)(end - begin) / CLOCKS_PER_SEC,(uint64_t)(gps_data.fix.time*1000.0));

fprintf(stdout,"\n PPS clk: %lld.%.9ld ", (long long)(gps_data.pps.clock.tv_sec), (long)(gps_data.pps.clock.tv_nsec));
  fprintf(stdout,"\n PPS rea: %lld.%.9ld ", (long long)(gps_data.pps.real.tv_sec), (long)(gps_data.pps.real.tv_nsec));
                                }
                        }
                //}
        }
}

Il giorno gio 4 lug 2019 alle ore 17:55 Gary E. Miller <address@hidden> ha scritto:
Yo Guido!

On Thu, 4 Jul 2019 17:31:03 +0200
Guido Gavilanes <address@hidden> wrote:

> Thank you Gary for taking time to answer.
> My ntpshm works on, I see the timestamps and ntp synch is working
> linke a charm (after a bunch of calibration runs).

Good. so gpsd works.

> the problem in fact is that in my program, when I read the pps
> timestamps I get:
> with socket:
> PPS clk: 1562247898.884325242  -> a realistic pps timestamp (UTC
> epoch in seconds, with subsecond information).
> and with shared memory:
> PPS clk: 0.1077805056              -> not comparable with the actual
> timestamp.

So the problem is in your program.  Can't say much without seeing
your code.

> in fact with socket export i can know how much time has passed since
> the PPS hit, but with shared memory export i cannot compare my local
> UTC time with pps timestamp, since seconds part is missing.

A) Nothing missing.

b) You don't need it.

> So it
> makes me conclude that the same information decoded under two
> different export methods is in fact different. The only explanation I
> have is that PPS is not exported in shared memory export. Is it
> really that?

gpsd sends PPS time to ntpd over SHM.  So we know that workx.

Look at the ntpshmmon code, and your code.

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


--
GUIDO ALEJANDRO GAVILANES CASTILLO
Istituto Superiore Mario Boella
Via P.C. Boggio 61 - ISMB
Cell: +39 3405269579
Tel: +39 0112276608
http://ismb.it/guido_alejandro.gavilanes_castillo

reply via email to

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