如何阅读ntptime状态代码?

时间:2017-03-02 16:28:04

标签: status ntp

NTP advanced configuration page开始,有以下文字

windl@elf:~ > ntptime
ntp_gettime() returns code 0 (OK)
  time bd6b9cf2.9c3c6c60  Thu, Sep 14 2000 20:52:34.610, (.610297702),
  maximum error 3480 us, estimated error 0 us.
ntp_adjtime() returns code 0 (OK)
  modes 0x0 (),
  offset 1.658 us, frequency 17.346 ppm, interval 128 s,
  maximum error 3480 us, estimated error 0 us,
  status 0x2107 (PLL,PPSFREQ,PPSTIME,PPSSIGNAL,NANO),
  time constant 6, precision 3.530 us, tolerance 496 ppm,
  pps frequency 17.346 ppm, stability 0.016 ppm, jitter 1.378 us,
  intervals 57, jitter exceeded 29, stability exceeded 0, errors 0.

后跟The first thing you should look at is the status (0x2107 in our case). The magic words in parentheses explain the meaning of the individual bits.

它们列出了5位的位置,但提供了4位十六进制状态代码,转换为16位。哪些是表示括号中关键字的位,以及其他位是什么意思?

1 个答案:

答案 0 :(得分:1)

以下是NTP状态代码列表

STA_PLL         0x0001  enable PLL updates (rw)
STA_PPSFREQ     0x0002  enable PPS freq discipline (rw)
STA_PPSTIME     0x0004  enable PPS time discipline (rw)
STA_FLL         0x0008  select frequency-lock mode (rw)

STA_INS         0x0010  insert leap (rw)
STA_DEL         0x0020  delete leap (rw)
STA_UNSYNC      0x0040  clock unsynchronized (rw)
STA_FREQHOLD    0x0080  hold frequency (rw)

STA_PPSSIGNAL   0x0100  PPS signal present (ro)
STA_PPSJITTER   0x0200  PPS signal jitter exceeded (ro)
STA_PPSWANDER   0x0400  PPS signal wander exceeded (ro)
STA_PPSERROR    0x0800  PPS signal calibration error (ro)

STA_CLOCKERR    0x1000  clock hardware fault (ro)
STA_NANO        0x2000  resolution (0 = us, 1 = ns) (ro)

来源:ftp://ftp.ripe.net/test-traffic/ROOT/libDelay/Delay.h

来自您列出的示例:status 0x2107 (PLL,PPSFREQ,PPSTIME,PPSSIGNAL,NANO)。 逻辑上' OR'状态位代码一起编码0x0001 | 0x0002 | 0x0004 | 0x0100 | 0x2000,结果为0x2107。

此处可找到有关状态代码的其他说明:
http://man7.org/linux/man-pages/man2/adjtimex.2.html