NTP 未与 GPS 同步

NTP 未与 GPS 同步

我尝试使用 NTP 和 GPS 同步时间。我可以从 cgps -s 命令获取时间,但 NTP 未与其同步。

这是我的 ntp.conf:

tos mindist 1.0

# GPS Serial data reference
server 127.127.28.0 minpoll 4 maxpoll 4 prefer
fudge 127.127.28.0 refid GPS
fudge 127.127.28.0 time1 +0.140  # coarse processing delay offset

# GPS PPS reference
server 127.127.22.0 minpoll 4 maxpoll 4
fudge 127.127.22.0 refid PPS
fudge 127.127.22.0 flag3 1  # enable kernel PLL/FLL clock discipline

这是 ntpd 状态:

# ntpq -c peer -c as -c rl
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 SHM(0)          .GPS.            0 l    -   16    0    0.000    0.000   0.000
 PPS(0)          .PPS.            0 l    -   16    0    0.000    0.000   0.000

ind assid status  conf reach auth condition  last_event cnt
===========================================================
  1 49508  801b   yes    no  none    reject clock_alarm  1
  2 49509  8011   yes    no  none    reject    mobilize  1
associd=0 status=c011 leap_alarm, sync_unspec, 1 event, freq_not_set,
version="ntpd [email protected] Wed Mar  8 00:02:05 UTC 2017 (1)",
processor="armv7l", system="Linux/3.14.2", leap=11, stratum=16,
precision=-20, rootdelay=0.000, rootdisp=34.350, refid=INIT,
reftime=00000000.00000000  Thu, Feb  7 2036 14:28:16.000,
clock=d66f067f.64a88e62  Thu, Jan  2 2014  5:26:23.393, peer=0, tc=3,
mintc=3, offset=0.000, frequency=0.000, sys_jitter=0.000,
clk_jitter=0.001, clk_wander=0.000

这是 cgps 命令的输出:

# cgps -s
┌───────────────────────────────────────────┐
│    Time:       2017-03-15T00:51:10.000Z   │
│    Latitude:    37.927624 S               │
│    Longitude:  145.135400 E               │
│    Altitude:   261.5 ft                   │
│    Speed:      0.1 mph                    │
│    Heading:    0.0 deg (true)             │
│    Climb:      0.0 ft/min                 │
│    Status:     3D FIX (5 secs)            │
│    Longitude Err:   +/- 61 ft             │
│    Latitude Err:    +/- 142 ft            │
│    Altitude Err:    +/- 75 ft             │
│    Course Err:      n/a                   │                                 
│    Speed Err:       +/- 194 mph           │                                 
│    Time offset:     -100926684.061        │                                
│    Grid Square:     QF22nb                │                                 
└───────────────────────────────────────────┘

这是 ntp 和 gps 的选项:

# ps | grep gps
  149 root     /usr/sbin/gpsd -n -P /var/run/gpsd.pid /dev/ttyS1    
# ps | grep ntp
11952 root     /usr/sbin/ntpd -g

我很欣赏任何可以指导正确方向的提示。

答案1

我遇到了同样的问题,SHM flag1 是罪魁祸首。为了清楚起见,这就是我解决它的方法(在 ntp.conf 中进行这些更改):

server 127.127.28.0 
fudge  127.127.28.0 time1 0.183 flag1 1 refid GPS
server 127.127.28.2 prefer
fudge  127.127.28.2 flag1 1 refid PPS

相关内容