[ntp:questions] sub microsecond offset with userland shm pps

rtxo gnu at localhost.wraith.sf.ca.us
Tue Sep 1 05:17:12 UTC 2009

Hi Folks--

I've built an external rtxo and plugged into a pc motherboard (PIII/500MHz, an antique),
and gotten sub microsecond offsets with the userland shm pps driver. The kernel is
debian 5.0.2 based (2.6.26), reconfigured, with one patch:

/usr/src/linux/include/linux/timex.h, #define SHIFT_PLL 2

The ntpd is 4.2.5p206 at 1.1972 (latest ntp-dev at the time). I did compile the ntpd
with the timex.h as hacked here:


An ntpq billboard shows this:

gnu at jane17.wraith.sf.ca.us[591] ntpq -p
      remote           refid      st t when poll reach   delay   offset  jitter
*SHM(0)          .SHM.            0 l    2   16  377    0.000    0.000   0.002
+wraith.wraith.s .PPS.            1 u   15   16  377    0.169    0.006   0.003
-thrall.wraith.s .PPS.            1 u   14   16  377    0.160    0.015   0.003
+smidge.wraith.s .GPS.            1 u   13   16  377    0.526   -0.008   0.031

gnu at jane17.wraith.sf.ca.us[592] ntpq -c rv
associd=0 status=0915 leap_none, sync_telephone, 1 event, clock_sync,
version="ntpd 4.2.5p206 at 1.1972 Sun Aug 30 07:10:18 UTC 2009 (3)",
processor="i686", system="Linux/2.6.26-doobian", leap=00, stratum=1,
precision=-19, rootdelay=0.000, rootdisp=0.417, refid=SHM,
reftime=ce4729b9.c765dd10  Mon, Aug 31 2009 22:03:53.778,
clock=ce4729c5.f382747a  Mon, Aug 31 2009 22:04:05.951, peer=52323,
tc=4, mintc=3, offset=0.000, frequency=0.009, sys_jitter=0.004,
clk_jitter=0.002, clk_wander=0.000,
access_policy=ocxo hack machine. Not recommended.

gnu at jane17.wraith.sf.ca.us[593] ntpdc -c kern
pll offset:           1.34e-07 s
pll frequency:        0.009 ppm
maximum error:        0.002236 s
estimated error:      1e-06 s
status:               2001  pll nano
pll time constant:    4
precision:            1e-09 s
frequency tolerance:  500 ppm

Note that ntpq is unable to properly show the sub microsecond offset (0.000),
but ntpdc shows about 134 nanoseconds. The 0.009 PLL value seems almost unreal.

This is with serial port gps/pps with the shm_splc userland code.
I have added this project to my web site "NTP server using PC gnu/linux and freebsd"
and will be updating it as I develop things further.


Some more interesting linux and ntp/time info:

It looks like libc6 2.10.1 has "good" nanosecond support for gettimeofday of
the right flavor, and the latest linux kernels have a nanokernel, plus Rodolpho's
pps code included. The linux from scratch 6.5 folks have a guide to building these
code bases, and I plan to put one together and see how it chimes.

Hope this inspires more hackage out there.


More information about the questions mailing list