Discussion:
[ntp:questions] Leap not in sync NTP
kamal c
2018-09-04 11:19:46 UTC
Permalink
i am trying to sync NTP with GPS . i'm not using gpsd, i'm using a c code
to put
populate the structure of the ntp as follows.

struct shmTime {
int mode; //0
int count;
time_t clockTimeStampSec; //converting the data from the gps
.
reciever into seconds
int clockTimeStampUSec; // getting the microseconds from os
time_t receiveTimeStampSec; // seconds from os
int receiveTimeStampUSec;
int leap; //0 (not sure what to fill)
int precision; //not sure what to fill
int nsamples; //not sure what to fill
int valid;
};

my ntp.conf file is:
------------------------------------------------------------
enable stats
statistics clockstats peerstats loopstats rawstats sysstats
statsdir /var/log/ntpstats/
filegen clockstats file clockstats type pid enable
filegen peerstats file peerstats type pid enable
filegen loopstats file loopstats type pid enable
filegen rawstats file rawstats type pid enable
filegen sysstats file sysstats type pid enable


driftfile /var/log/ntp.drift # path for drift file
logfile /var/log/ntp.log # alternate log file

# shared memory configuration
server 127.127.28.0 minpoll 4 maxpoll 4
fudge 127.127.28.0 time1 0.420 flag1 1 refid SHM1 stratum 2

server 127.127.28.1 minpoll 4 maxpoll 4 prefer
fudge 127.127.28.1 time1 0.420 flag1 1 refid SHM2 stratum 2
-----------------------------------------------------------------
my ntpq -p is:

--------------------------------------------------------------------------
remote refid st t when poll reach delay offset
============================================================================
*SHM(0) .SHM1. 2 l 1 16 377 0.000 1425.68
SHM(1) .SHM2. 2 l - 16 0 0.000 0.000
----------------------------------------------------------------------------

NTP is selecting the shared memory as the server as there is a * indicated

But when i am running the ntpdate -d <ip of the server>
i am getting "server dropped : leap not in sync"

And when i run ntpq -c rl in the server the output is:
------------------------------------------------------------------
associd=0 status=c413 leap_alarm, sync_uhf_radio, 1 event, spike_detect,
version="ntpd ***@1.3728 Mon Jul 9 09:02:16 UTC 2018 (1)",
processor="i686", system="Linux/4.8.0-36-generic", leap=11, stratum=3,
precision=-24, rootdelay=0.000, rootdisp=1429.253, refid=SHM(0),
reftime=df393e4d.1d6cd725 Tue, Sep 4 2018 10:24:29.114,
clock=df393e55.0ce07222 Tue, Sep 4 2018 10:24:37.050, peer=53967, tc=4,
mintc=3, offset=0.000000, frequency=500.000, sys_jitter=0.000000,
clk_jitter=0.000, clk_wander=0.000
----------------------------------------------------------------------------

the leap field is 11 which means the server is not in sync . i'm running
continously
for 1 hr but still no sync

is it the shared memory problem??

what am i doing wrong??

Loading...