USB GPS gongle as NTP time source

Does anyone here have advice on using a GPS dongle as a time source? I have customers that seem to have really fuzzy clock sync to NTP servers (~10ms accuracy) and they would like something within or better than 1ms accuracy. Some of the GPS dongles I see on Amazon indicate 60ns accuracy, but I cannot tell if they are Linux compatible.

I’m pretty sure that to get accurate time from a GPS module you need one which outputs a PPS signal which is usually done over serial. Not sure if there’s a way to do it over USB.

2 Likes

I saw some references to serial interfaces in some posts. Are there any links that you can drop?

I am planing to go down the raspberry pi route: GPS Raspberry Pi NTP Server Hope this helps

Oh boy, bit of a minefield this can be.

If you want a “proper” time source for the network, you want something like

This - PCIe-GPS | Sub-millisecond Timing Accuracy | Masterclock Products
Or an open source option - Time-Appliance-Project/Time-Card at master · opencomputeproject/Time-Appliance-Project · GitHub
Or a network attached appliance (I’ve personally installed NTP Server Device | GPS NTP Time Server TM1000A before)

Note there’s a limit to how accurate you can get with GPS+NTP - I’d be very suspicious about anything cheap-n-cheerful promising sub-millisecond accuracies. If you want more, you start to hit the limits of NTP and need to start looking into PTP, which essentially requires rebuilding the network around PTP.

Does the work your customer does warrant investing in ultra-accurate time sync? If not I wouldn’t stress about a few MS here or there in NTP sync - get a decent GPS-based card or appliance (or two ;)), set it and forget it. PTP requires hardware and software that’s designed for it to really take advantage of it.

6 Likes

Tuning the NTP clients may help a lot, too.

Use chronyd instead of ntpd making sure to take advantage of hardware timestamping.

4 Likes

@ScottishTom those are some very good links! Unfortunately the systems we sell to customers frequently use all the PCIe slots for wifi radios, but the TimeMachines item looks very interesting!

1 Like

@jode I was unaware of this quality of chronyd. Looking at some posts comparing the two

Also, as I mentioned before, take a look at hardware timestamping.

The intro sets good expectations to the level of accuracy that ntp can deliver in modern environments:

“Over the 30 years NTPv4 and its predecessors have evolved, accuracy expectations have improved from 100 ms to less than 1 ms on fast LANs with multiple segments interconnected by switches and less than a few milliseconds on most campus and corporate networks with multiple LANs interconnected by routers. However, the ultimate accuracy limit for typical workstations and PCs of today is a few microseconds with a GPS receiver, PPS signal and kernel PPS support.”

You can check for hw timestamping support in your NIC with ethtool -T eth0

1 Like