Believe it or not, I have people who work for my company who will literally wait until the very last second to get their data input into our various databases (I know, shocker! right?!). These are adults we’re talking about here and they should know better. If we set a midnight deadline to complete a task, I don’t want to argue with these folks over whether a 12:00:01 timestamp is within a margin of error. We want all of our servers to be in lock-step with each other so we can, without hesitation, say all of our timestamps are within a millisecond of the US Naval Observatory’s Atomic Clock and that the midnight oil burners are LATE!
Generally, we make sure all of our servers are synced up to the same Network Time Protocol (NTP) server pool. However, clocks can still drift over time if they are unable to sync up with a server that might also serve a million other hosts and can often become swamped. These are time servers hosted by other people, and it can be difficult to verify how close they are to a standard time.
If you don’t want to rely on the many clusters of NTP servers scattered around the world, there are several enterprise class appliances out there that allow you to set up a time server on your local network by mounting a GPS antennae to the roof of your datacenter. This allows the appliance to utilize the timecode that the network of GPS satellites transmits. This is the same signal that allows you and your iPhone to know exactly how to navigate to the closest 5 Guys Burgers. The GPS timecode is based on the US Naval Observatory’s Atomic Clock and is generally accurate to within 40 nanoseconds. This creates Stratum 1 NTP Server on your own network and is, I dare say, rather sexy! However, these NTP/GPS appliances cost thousands of dollars. That’s a ridiculous sum for something that I an fairly confident that I can build myself for about $150.
With that in mind, I decided it was time to put my soldering iron and my own money to the test. I created this device for my home network as a testbed for atomic clock level awesomeness. If it proves reliable, I’ll probably build additional NTP servers based on Raspberry Pi, but without the little flat screen display, for my company’s datacenters. In the meantime, I can sleep peacefully knowing that my PC backups will start exactly at midnight, that my walkway lights will turn on exactly 5 minutes after sunset, and that my Google controlled thermostat will kick on exactly 30 minutes before my iPhone alarm clock tells me it’s time to get out of bed…. well within +/- 0.00000004 seconds.
These are the pieces of the puzzle I used to make my NTP/GPS clock. ping me if you have specific questions.