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));
}
}
//}
}
}