Not quite 5 minute guide to making an NTP Server

This is an article on making a network attached Stratum 1 NTP Server using a Raspberry Pi+ Model 2 or 3 and the Uputronics Raspberry Pi+ GPS Expansion Board. If you need a standalone ready to go solution or need more performance please consider the LeoNTP Networked Time server unit which is available here.

As of May 2016 this was heavily reworked due to a new version of Raspbian which did all sorts of wonderful things like disabling the serial ports etc. This guide assumes Raspbian Jessie Lite June 2017 2017-06-21. No other version or distribution is supported.

I’ve also removed the off grid/standalone instructions as NTP isn’t designed to work off grid using just the NMEA derived time and PPS to discipline it.

HAB Supplies Raspberry Pi+ GPS Expansion Board

Uputronics Raspberry Pi+ GPS Expansion Board

Ideally rather than supplying a premade image I would have a set of concise instructions on making your own install from scratch so you could use the latest versions of the software. With assistance from David Taylor who did lots of background work on this here I present the following instructions on making a cheap PPS disciplined NTP Time server using one of the Raspberry Pi+ GPS boards sold on Uputronics.

The guide assumes you have a cursory knowledge of Linux, enough to install Raspbian and login should do.

You will need a Raspberry Pi 2 or 3 B+, the Uputronics Raspberry Pi+ GPS Expansion Board and a suitable GPS antenna.

This guide is assuming you’re using Raspbian Jessie Lite installed from the June 2017 image. Download and write this to an SD card (See http://www.raspberrypi.org/documentation/installation/installing-images/README.md). Other distributions may work but these instructions are known to work with Raspbian Jessie Lite.

Attach the Uputronics Raspberry Pi+ GPS Expansion Board to the Pi, insert the SD card, connect the antenna and network cable and boot the Pi up. Either connect locally or via SSH to the Pi. Follow the instructions carefully if you miss steps things won’t work.

Text in italics is what you type.
Text in red indicates editing inside a file.

Prerequisite Settings

sudo raspi-config
5 Interfacing Options
P2 SSH -> Would you like the SSH server to be enabled – YES (Recommended)
P6 Serial -> Login Shell (no) Hardware (yes)
Quit but no need to reboot at this point.

sudo nano /boot/config.txt
Add at the bottom :
# Allow the normal UART pins to work
dtoverlay=pi3-miniuart-bt
dtoverlay=pps-gpio,gpiopin=18
Save and Quit Nano.

sudo apt-get update
sudo apt-get dist-upgrade

sudo systemctl disable hciuart
sudo systemctl mask serial-getty@ttyAMA0.service

sudo apt-get install pps-tools
sudo apt-get install libcap-dev
sudo reboot

Verifying PPS Is Working

Ensure the GPS has a lock and the Green PPS LED on the Uputronics Pi+ GPS Expansion Board is blinking once a second.

dmesg | grep pps

Output should be similar to :

[ 2.443494] pps_core: LinuxPPS API ver. 1 registered
[ 2.446699] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 2.471796] pps pps0: new PPS source pps.-1
[ 2.471886] pps pps0: Registered IRQ 498 as PPS source
[ 6.965166] pps_ldisc: PPS line discipline registered
[ 6.966569] pps pps1: new PPS source ttyAMA0
[ 6.966664] pps pps1: source "/dev/ttyAMA0" added

sudo ppstest /dev/pps0

Output should be similar to:

 trying PPS source "/dev/pps0"
 found PPS source "/dev/pps0"
 ok, found 1 source(s), now start fetching data...
 source 0 - assert 1418933982.998042450, sequence: 970 - clear  0.000000000, sequence: 0
 source 0 - assert 1418933983.998045441, sequence: 971 - clear  0.000000000, sequence: 0

(Press CTRL+C to quit). This indicates the PPS Module is loaded (top example) and is working (bottom).

GPS board mounted in Geaux Robot Dog Bone Case for Raspberry Pi B+ also available from HAB Supplies

GPS board mounted in Geaux Robot Dog Bone Case for Raspberry Pi B+ also available from Uputronics

Enabling PPS/ATOM Support in NTPD

The supplied version of NTPD on the Raspberry Pi doesn’t support PPS so we need to recompile it (Please note that some of these steps may take up to 30 minutes).

wget https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p10.tar.gz
tar zxvf ntp-4.2.8p10.tar.gz
cd ntp-4.2.8p10
./configure  –enable-lcap
make -j4
sudo make install
sudo service ntp stop
sudo cp /usr/local/bin/ntp* /usr/bin/ && sudo cp /usr/local/sbin/ntp* /usr/sbin/
sudo nano /etc/ntp.conf

Add
server 127.127.22.0 minpoll 4 maxpoll 4
fudge 127.127.22.0  flag3 1  refid PPS

Amend

server 0.debian.pool.ntp.org iburst prefer

You may also want to add your local lan to so you can query the NTP Server by adding:
restrict 192.168.1.0 mask 255.255.255.0

Note You MUST add a preferred server or PPS doesn’t work. Its worth at this point seeing if you’re ISP has its own NTP server you can use and adding that but for the purposes of this exercise adding prefer to the Debian pool one will do.

Save and close nano.

sudo nano /etc/init.d/ntp
Find the line NTPD_OPTS=”$NTPD_OPTS -u $UGID”
Amend it to say NTPD_OPTS=”$NTPD_OPTS”

sudo systemctl daemon-reload

sudo service ntp restart

After a few minutes run

ntpq –p

if you get oPPS(0) this indicates source selected, Pulse Per Second (PPS) used and everything is working.

If you aren’t seeing the settings its possible the NTP server is picking up the NTP information via DHCP which is over riding your settings above. Do this :

rm /etc/dhcp/dhclient-exit-hooks.d/ntp
rm /var/lib/ntp/ntp.conf.dhcp

At this point you have a NTP server which will use an external time source and use your local PPS to discipline it.

Setting Stationary Mode

Grab this small program:

wget <a href="https://www.dropbox.com/s/eaycedsmb2o9kn0/gpsControl.c?dl=0">https://dl.dropboxusercontent.com/u/63720513/Code/gpsControl.c</a>

Compile + link:
gcc -o gpsControl gpsControl.c

sudo ./gpsControl -p -d /dev/ttyAMA0 = Portable Mode
sudo ./gpsControl -s -d /dev/ttyAMA0 = Stationary Mode

May take a few goes to set it.

pi@hypatia:~ $ sudo ./gpsControl -s -d /dev/ttyAMA0
Set GPS for stationary mode
Configuring device /dev/ttyAMA0
>>>>>>>>>>>>>>>>>>>>> SENDING >>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> SENDING >>>>>>>>>>>>>>>
GPS mode set OK

Static IP + Hostname

If you want to fix your LAN IP you do it by amending /etc/dhcpcd.conf adding the following lines:

interface eth0
static ip_address=192.168.1.7/24
static routers=192.168.1.254
static domain_name_servers=8.8.8.8 8.8.4.4

Amend your hostname by editing /etc/hostname and then adding this to /etc/hosts as well. I.e if you call your machine ‘eleanor’ add this after localhost in /etc/hosts:

127.0.0.1 localhost eleanor

Further Reading

David Taylor’s website here http://satsignal.eu/ntp/Raspberry-Pi-NTP.html goes into much further detail about the process above and covers graphing, remote access monitoring etc and I highly recommend you read it.

References from this draft document by Eric S. Raymond https://www.ntpsec.org/white-papers/stratum-1-microserver-howto/

Hope this helps, let me know how you get on with these instructions and I’ll try keep them up to date.

Thanks to:

David Taylor
Dave Akerman
Chris Stenton for the new kernel fix.
Tris Mabbs for the DHCP issue heads up.
Michiel Kanis for testing DHCP fix.
Phil Heron for the GPSD Autostart fix.

Updated : 27/06/17 Fixed for new June 2017 Raspbian. Updated links to ntp-4.2.8p10.
Updated : 25/05/16 Fixed for Pi3/May Raspbian. Removed Standalone mode (NTP isn’t designed for this)
Updated : 22/03/16 Added Pi3/Standalone etc
Updated : 24/02/16 Added Code to set stationary mode.
Checked : 29/09/15 Works with Raspian Jessie – Thx Ciaran!
Updated : 03/07/15 NTP version and location amended – Thx Greg!
Checked : 13/06/15 Works with 2015-05-05-raspbian-wheezy.img
Updated : 13/04/15 ntp-4.2.8p2.tar.gz links updated.
Updated : 23/02/15 Verified these instructions are good with 2015-02-16-raspbian-wheezy.img as a base
Updated : 20/02/15 ntp-4.2.8p1.tar.gz links updated.
Updated : 28/01/15 DHCP Client can pick up NTP from DHCP server and override all your good work. See below.
Updated : 27/01/15 New kernel breaks previous instructions. Updated.
Updated : 26/12/14 Updated NTP to 4.2.8 and tested with Raspbian 2014-12-14

Leave a comment ?

174 Comments.

  1. @Claudio, of course has also the kernel 4.9 PPS support.

    Linux jumper 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux
    grep PPS linux/.config
    # PPS support
    CONFIG_PPS=m
    # CONFIG_PPS_DEBUG is not set
    # PPS clients support
    # CONFIG_PPS_CLIENT_KTIMER is not set
    CONFIG_PPS_CLIENT_LDISC=m
    CONFIG_PPS_CLIENT_GPIO=m
    # PPS generators support

  2. Greg Siemon

    @Spacerat Yes the kernel supports PPS but Claudio was asking about “kernel mode”. My previous post had instructions to enable it (by recompiling the kernel) for Kernel 4.4. Kernel 4.9 has changed a couple of things and I have now worked out how to enable “kernel mode”.

    @Claudio
    My earlier instructions are still correct but one more things needs to be done in the Timer subsystem when running “make menuconfig”. There is a section under General Setup – Timers Subsystem called Time tick handling (Idle dynticks system (tickless idle)). Periodic timer ticks (constant rate, no dynticks) needs to be selected to be able to see and enable PPS Kernel Consumer Support.

  3. Just started this yesterday, downloaded the rasbian jessie form June, and get the following errors while following the guide:

    ./configure –enable-lcap
    configure: WARNING: you should use –build, –host, –target
    configure: WARNING: invalid host type: –enable-lcap
    checking for a BSD-compatible install… /usr/bin/install -c
    checking whether build environment is sane… yes
    checking for a thread-safe mkdir -p… /bin/mkdir -p
    checking for gawk… no
    checking for mawk… mawk
    checking whether make sets $(MAKE)… yes
    checking whether make supports nested variables… yes
    checking whether make supports nested variables… (cached) yes
    checking build system type… Invalid configuration `–enable-lcap’: machine `–enable’ not recognized
    configure: error: /bin/bash sntp/libevent/build-aux/config.sub –enable-lcap failed

    If I switch it to “./configure -enable-linuxcaps” configure seems to run through, but on make it locks up the pi.

    Any thoughts?

  4. Running the configure as specified in the ntp readme got it working and compiling

    http://www.linuxfromscratch.org/blfs/view/cvs/basicnet/ntp.html

    ./configure CFLAGS=”-O2 -g -fPIC” \
    –prefix=/usr \
    –bindir=/usr/sbin \
    –sysconfdir=/etc \
    –enable-linuxcaps \
    –with-lineeditlibs=readline \
    –docdir=/usr/share/doc/ntp-4.2.8p10 &&
    make

  5. Frank de Graaf

    @Joel: it’s a matter of the way the text is formatted. the single dash is actually — (minusminus)

  6. Hi Greg and Eric,
    While compiling the Kernel, is there have any issue with the Pi version (Rpi-2,Rpi-3) or with the version of Raspbian (Jessie Lite, Jessie Desktop), please?
    Previously i successfully compiled the kernel with Rpi-3, Jessie Desktop. But while I am switching to Rpi-2 with Jessie Lite, I am getting Make Error:2.

    The overall make output is here:

    https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=189742

    Any suggestion, please?

  7. Dustin Marquess

    I agree with Steve Moorby’s comment. Use the NMEA driver and NOT another NTP server (although I’d add another NTP server and flag it with “noselect” just to monitor things). No recompiling needing, and only one server/fudge line is needed.

  8. Dana Dawson

    Just as an FYI for other who may be curious, I was just successful in getting NTP working on a RPi 3 with the recent Stretch Lite version of Raspian (“2017-08-16-raspbian-stretch-lite”) by following these instructions almost exactly. I did have to do a “sudo apt-get install ntp” on my Pi, since Stretch Lite didn’t seem to include it and my first attempt didn’t work. I then modified my install according to instructions by Mark Martinec (first comment post by Anthony) and got the stand-alone NMEA one-driver mode working. The only issue I have yet to resolve is that the udev mod to create the symlinks in /dev doesn’t work, so I have to create them manually after a reboot. Here are my stats after about 17 hours of uptime:

    
    pi@pi-ntp:~$ 
    pi@pi-ntp:~$ ntpq -p
         remote           refid      st t when poll reach   delay   offset  jitter
    ==============================================================================
    oGPS_NMEA(0)     .GPS.            0 l    1   16  377    0.000    0.000   0.001
    pi@pi-ntp:~$ 
    pi@pi-ntp:~$ 
    pi@pi-ntp:~$ ntpq -c rv
    associd=0 status=0418 leap_none, sync_uhf_radio, 1 event, no_sys_peer,
    version="ntpd 4.2.8p10@1.3728 Sat Aug 26 00:08:54 UTC 2017 (1)",
    processor="armv7l", system="Linux/4.9.41-v7+", leap=00, stratum=1,
    precision=-20, rootdelay=0.000, rootdisp=1.090, refid=GPS,
    reftime=dd4c6fac.1f74d035  Sat, Aug 26 2017 17:07:40.122,
    clock=dd4c6fb2.1fae9b55  Sat, Aug 26 2017 17:07:46.123, peer=9998, tc=4,
    mintc=3, offset=-0.000291, frequency=-4.345, sys_jitter=0.001215,
    clk_jitter=0.002, clk_wander=0.000
    pi@pi-ntp:~$ 
    

  9. Thanks for this! I followed the instructions and I’m up and running.

    However, Dropbox gives a file not found error for the gpsControl.c file listed in the stationary mode section. Is the file available elsewhere?

  10. Dana Dawson

    UPDATE: MY problem with the udev mod to automatically create the symlinks in /dev for the gps devices was caused by smart quotes in the text file instead of the basic ASCII double-quote character. Fixing that fixed the udev issue.

    I’m now having trouble getting ntpd to sync to the GPS clock source, but I’m still looking into that issue.

  11. Dana Dawson

    I’m now getting the same “leap_alarm” status as Alex is/was seeing, and I’ve not been able to find anything that might explain the cause. Also, the “gpsmon” utility has stopped working, though the output from “ppstest” still looks good. I’ll keep digging, but for now I think I’m stuck and I’m tempted to wipe the Pi and just start completely over.

  12. Dana I’m about to embark on the same journey you are on.

    I have a specific deadline and a specific event that I need my project for complete and operational, so I will be following you and will do what I can to help you and hopefully you helping me at the same time.

    I don’t yet know how to leave my email address for you but as soon as I figure that out I will, as well as posting my results here as this is where the original inspiration for my project came from….

    Thanks to you Anthony and the other contributors here….!!!

  13. Anthony I reread your earlier response to my question, and am starting over again with the newest Raspbian (Stretch), and I am also adding a RTC module:

    https://www.newegg.com/Product/Product.aspx?Item=9SIA7BF34D9011&cm_re=10pcs_DS3231_Precision_RTC_Module_Memory_Module_for_Raspberry_Pi_Arduino-_-9SIA7BF34D9011-_-Product

    IF POSSIBLE to have a redundant backup, the new GPS module seen here:

    https://v3.airspy.us/product/upu-ublox-m8q3a-sma/

    I am not sure how to go about integrating the two or if it is even possible but 10 of those RTC’s came out to be only a little over $1 each USD. so no harm if not usable. But any advise you can add would be greatly appreciated indeed….!!!

  14. The Project Director email address on the contact page of our website will get you directly in-touch with me….you can click on my name above to reach our website….thank you all….

  15. Have I made some type of comment blunder that has resulted in my comments/questions being removed, if so please advise so that I may address any issues. I have a very serious project that I am embarking on that will be displayed in front of some very important and significant persons in the world of motor-sports. and I would like to be successful.

    I am hoping with the help of everyone here that I can be.

    Please do not ban me.

    Alan Scott

  16. Chill 🙂 Comments are moderated and i’ve been out all day 🙂 I know someone who has used an RTC module in combination with my board. They use I2C so should happily work with the GPS board.

  17. I am following this recipe for building the GPS – 1PPS disciplined time server:
    http://ava.upuaut.net/?p=726

    I am using an RPI 3 B+ and the latest Kasparian (Stretch) distro

    This GPS Board:
    https://v3.airspy.us/product-tag/gps/page/2/

    I also have purchased a bunch (10 actually) of these RTC’s, as a redundant backup to the GPS system as the new PI’s don’t have an internal RTC
    https://www.newegg.com/Product/Product.aspx?Item=2A7-00BD-00B48

    Additionally, I have a differential pressure switch that detects the puff of air when the car drives over the air hose that needs to be connected.

    I actually have a couple questions now that I think about it:

    1. How to I incorporate the RTC OVER the GPS card, do I use super long pins
    (btw thank you for the ones you provided) but I have four (4) of these units to build
    so a trip to FRYS seems inevitable……LOL I don’t really want it to be a 3 layer PI.

    Or is adding the RTC using an elephant gun to kill a mosquito……?

    2. The differential pressure switch is in a separate housing so it will have just 2 wires to attach to the PI…….where & how…?

    3. Will I have to load some type of lib or something to make it work….(don’t have the exact sensor model with me right now)

    4. If my reading of the instructions for the time server are correct one of the first things
    you are instructed to do is kill all serial coms…for the GPS card.

    5. Doesn’t #4 above kind of kill all the rest after the GPS – PPS…….? There are 40 GPIO pins there do ALL of them really need to be
    Killed so 5 of them can run a GPS receiver….?

    6. Basically, how the hell do I put this damn thing together,

    I have all the parts, at least almost all of them…
    A semi firm grasp on Linux itself….
    OK, it could be better maybe but I pretty much get Linux at least…
    I have a decent soldering station at home.
    Paul is 3D Printing me custom PI cases with a recess in the lid for solar powered rechargeable battery pack….(new this week)
    The “debut” of the system is the first of NOV at the race in Mesquite NV.
    The time stamping recording and GUI software is 98% written and tested.

  18. Dana Dawson

    I’ve got things back working now. Here’s a summary of what I did:

    First, I grabbed the latest version of Raspian Stretch Lite, which was “2017-09-07-raspbian-stretch-lite.zip”, and installed it on my SD card. I also added an empty “ssh” file to the “/boot” directory of that SD card to enable immediate SSH access to the RPi on first boot. I then followed all the basic instructions as described in the main article, with the addition of doing a “sudo apt-get install ntp”, since Stretch Lite doesn’t seem to include it.

    When I got to the section on “Verifying PPS Is Working” my output was slightly different and didn’t mention the “/dev/ttyAMA0” device:

    
    pi@pi-ntp:~$ dmesg | egrep pps
    [    3.668512] pps_core: LinuxPPS API ver. 1 registered
    [    3.668530] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
    [    3.677134] pps pps0: new PPS source pps.-1
    [    3.677239] pps pps0: Registered IRQ 184 as PPS source
    pi@pi-ntp:~$ 
    

    The output of “sudo ppstest /dev/pps0” looked fine, though, so I continued on with the configuration process.

    In the “Enabling PPS/ATOM Support in NTPD” section, I downloaded the ntp source by simply prepending a “wget” in front of the URL, like this:
    wget https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p10.tar.gz

    which worked just fine. The “./configure” step, however, didn’t seem happy with any of the options I tried, so I just did a simple “./configure” with no options at all. All the other commands worked just fine.

    Since I knew I wanted to run this in standalone mode as described by Mark Martinec, I did not make the “Add” and “Amend” changes to “/etc/ntp.conf”, but instead added these lines as described by Mark:

    
    # NMEA /dev/gps0, /dev/gpspps0, RMC, 9600
    server 127.127.20.0 mode 17 minpoll 4 maxpoll 4 prefer
    fudge 127.127.20.0 flag1 1 flag3 0 time2 0.115
    

    I also commented out all the “pool.ntp.org” lines, and added a “restrict” line for my local LAN just to be explicit (I don’t think I needed that, since the existing restrict lines are probably fine). Here’s the line I added in case anyone’s curious:

    restrict 172.31.254.0 mask 255.255.255.0 nomodify notrap

    At this point I was still following the instructions in Mark’s first post, and I created a new “/etc/udev/rules.d/55-ntp-gps.rules” file with these two lines:

    
    SUBSYSTEM=="tty", KERNEL=="ttyAMA0", SYMLINK+="gps0"
    SUBSYSTEM=="pps", KERNEL=="pps0", SYMLINK+="gpspps0"
    

    As I mentioned previously, the reason this didn’t work before was that I copy/pasted the lines from the web page, but that changed the basic ASCII straight double-quotes to some sort of smart quotes, which the udev process didn’t like. From my digging into the details of how udev works, I simplified the lines in Mark’s post to those shown above and they seem to be working fine.

    I was now back to the main instructions, and I made the specified changes to “/etc/init.d/ntp” along with the subsequent two “sudo” command to reload/restart things.

    After several minutes my “ntpq -p” output looked like this, which seemed positive:

    
    pi@pi-ntp:~$  ntpq -p
         remote           refid      st t when poll reach   delay   offset  jitter
    ==============================================================================
    oGPS_NMEA(0)     .GPS.            0 l    2   16  377    0.000    0.000   0.002
    pi@pi-ntp:~$ 
    

    At some point in this process I also modified “/etc/dhcpcd.conf” and “/etc/hosts” as described to configure a static IP address, which also worked just fine, though I did notice that with the newer version of Stretch Lite the interface name is back to being simply “eth0” instead of the previous name that included the hardware MAC address of the interface. I did not bother with the steps under “Setting Stationary Mode”, since I was trying to minimize the changes I made.

    So, things seem to be working fine now, and my “ntpq -crv” output currently looks like this:

    
    pi@pi-ntp:~$ ntpq -crv
    associd=0 status=0415 leap_none, sync_uhf_radio, 1 event, clock_sync,
    version="ntpd 4.2.8p10@1.3728 Wed Sep 27 21:55:30 UTC 2017 (1)",
    processor="armv7l", system="Linux/4.9.41-v7+", leap=00, stratum=1,
    precision=-20, rootdelay=0.000, rootdisp=1.075, refid=GPS,
    reftime=dd77e908.59d8dc4d  Thu, Sep 28 2017 16:32:56.350,
    clock=dd77e90d.ef0d3dfe  Thu, Sep 28 2017 16:33:01.933, peer=16811, tc=4,
    mintc=3, offset=-0.000116, frequency=-4.392, sys_jitter=0.000954,
    clk_jitter=0.001, clk_wander=0.000
    pi@pi-ntp:~$ 
    

    I’m going to resist any urges that might come over me to do any software updates in the hope that it’ll stay reliably available, but I guess I’ll find out. I’ll try to follow up here with any updates that seem useful, or to check for any questions anyone might have.

  19. Tom Dilatush

    I had some trouble with the code suggested here for setting stationary mode, I think related to the fact that my setup is on a Raspberry Pi 3 running Jessie. I fixed the problem by writing my own slightly more specialized program to set the GPS in stationary mode and to save the configuration. I made no attempt to generalize the code – it assumes the serial port settings, and that the serial port is “serial0”. Anyone else who might be having trouble with the stationary mode setting, please feel free to download the code, compile it, and hopefully it will reward you with successfully setting stationary mode and saving the resulting configuration!

  20. @ Dana Dawson

    Although your NEMA source appears stabilized with low jitter and offset, I question if your source is giving you the correct time. Check it against other public time servers for verification by either adding pool us.pool.ntp.org noselect or checking your system time against a manual query: pi@piClock:~$ ntpdate -q us.pool.ntp.org.

    I suspect that you have sync’d your system time to your NEMA source which is off by at least 500ms to more than 1000ms.

    Here is my attempt at your setup (I am not using kernel mode PPS):

    
    pi@piClock:~ $ sudo ntpq -pw
         remote           refid      st t when poll reach   delay   offset  jitter
    ==============================================================================
    oGPS_NMEA(0)     .GPS.            0 l   12   16  377    0.000    0.000   0.004
    
    pi@piClock:~ $ ntpdate -qv us.pool.ntp.org
    24 Oct 21:59:10 ntpdate[32706]: ntpdate 4.2.8p10@1.3728-o Sun Oct 22 17:46:33 UTC 2017 (2)
    server 66.85.74.226, stratum 2, offset 1.001754, delay 0.08554
    server 45.79.109.111, stratum 2, offset 1.002203, delay 0.06090
    server 69.61.82.106, stratum 2, offset 0.999959, delay 0.11128
    server 45.79.111.114, stratum 2, offset 1.001766, delay 0.04811
    24 Oct 21:59:16 ntpdate[32706]: step time server 45.79.111.114 offset 1.001766 sec
    

    I think for this reason, some may suggest not using the NEMA Type 20 driver, but rely on PPS Type 22 along with other public servers instead. Or I’ve seen the case for manually offsetting the NEMA source by a large amount by adjusting time2 by a larger amount.

  21. Dana Dawson

    @xycmu

    I ran that command and this is what I got:

    
    pi@pi-ntp:~$ ntpdate -qv us.pool.ntp.org
     1 Nov 18:21:30 ntpdate[24996]: ntpdate 4.2.8p10@1.3728 Wed Sep 27 21:55:35 UTC 2017 (1)
    server 204.11.201.12, stratum 2, offset -0.002582, delay 0.07967
    server 108.59.2.24, stratum 2, offset 0.006258, delay 0.06361
    server 108.61.73.244, stratum 2, offset -0.001094, delay 0.05481
    server 208.88.126.235, stratum 2, offset -0.005778, delay 0.07410
     1 Nov 18:21:37 ntpdate[24996]: adjust time server 108.61.73.244 offset -0.001094 sec
    pi@pi-ntp:~$ 
    

    I don’t know how good the numbers should be, but these don’t look too bad.

  22. Dana Dawson

    I’ve been checking the results of the “ntpdate -q” command periodically over the past couple days and my results are always in line with those in my previous post. Here are my latest, to a larger number of ntp.org servers:

    pi@pi-ntp:~$ for n in `seq 0 3`; do ntpdate -q $n.pool.ntp.org; ntpdate -q $n.us.pool.ntp.org; done | egrep ntpdate
    3 Nov 12:59:21 ntpdate[20585]: adjust time server 97.127.8.173 offset -0.000182 sec
    3 Nov 12:59:28 ntpdate[20597]: adjust time server 23.92.29.245 offset -0.000914 sec
    3 Nov 12:59:35 ntpdate[20598]: adjust time server 192.111.144.114 offset 0.002325 sec
    3 Nov 12:59:41 ntpdate[20599]: adjust time server 69.89.207.99 offset -0.000152 sec
    3 Nov 12:59:49 ntpdate[20600]: adjust time server 4.53.160.75 offset -0.002405 sec
    3 Nov 12:59:56 ntpdate[20611]: adjust time server 204.9.54.119 offset -0.000196 sec
    3 Nov 13:00:03 ntpdate[20612]: adjust time server 38.229.71.1 offset -0.000576 sec
    3 Nov 13:00:10 ntpdate[20613]: adjust time server 152.2.133.54 offset 0.001285 sec
    pi@pi-ntp:~$ </code.

  23. Tom Dilatush

    I’ve made a much better program for configuring the U-Blox GPS. I’ve made it publicly available in source form, on GitHub. I was able to use it to complete all the recommended configurations to maximize time accuracy (they’re fairly complicated). You can find the code here.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Human test : * Time limit is exhausted. Please reload CAPTCHA.