{"id":492,"date":"2018-09-04T19:43:58","date_gmt":"2018-09-05T02:43:58","guid":{"rendered":"https:\/\/ag6qr.net\/?p=492"},"modified":"2018-09-04T22:00:33","modified_gmt":"2018-09-05T05:00:33","slug":"what-time-is-it","status":"publish","type":"post","link":"https:\/\/ag6qr.net\/index.php\/2018\/09\/04\/what-time-is-it\/","title":{"rendered":"What Time is it?"},"content":{"rendered":"<p>My computers now know what time it is, to the millisecond, without using the Internet.<\/p>\n<p>I put together a stratum-1 ntp time server, based on a Raspberry Pi 3 model B with an <a href=\"https:\/\/www.adafruit.com\/product\/2324\">Adafruit Ultimate GPS Hat<\/a>. \u00a0I put the whole thing into a\u00a0<a href=\"https:\/\/c4labs.net\/products\/zebra-gps-hat-case-for-raspberry-pi-3-pi-zero-a-b-or-pi-2-black-ice\" target=\"_blank\" rel=\"noopener\">C4 Labs Zebra GPS HAT Case<\/a>, made of layers of shiny acrylic. \u00a0The case is entirely too beautiful, considering that I&#8217;m keeping this unit on a shelf in my garage, high up and out of sight, but it provides good dust protection, and the acrylic top is not only transparent to visible light, but it also allows the GPS signals to be received with the GPS unit&#8217;s built-in patch antenna, even indoors under my garage roof (the thinnest roof in my house, one layer of wood plus some composite shingles).<\/p>\n<div id=\"attachment_493\" style=\"width: 1010px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-493\" class=\"size-full wp-image-493\" src=\"https:\/\/ag6qr.net\/wp-content\/uploads\/2018\/08\/DSE_5121.jpg\" alt=\"\" width=\"1000\" height=\"1184\" \/><p id=\"caption-attachment-493\" class=\"wp-caption-text\">Stratum-1 Time Server<\/p><\/div>\n<p>Why? \u00a0Because I can, mostly.\u00a0 No, this has nothing to do with my earlier post on the <a href=\"\/index.php\/2018\/08\/14\/say-it-aint-so-wwv-wwvh-wwvb-on-the-chopping-block\/\" target=\"_blank\" rel=\"noopener\">possible demise of WWV\/WWVB<\/a>. \u00a0 I do have a use for accurate computer time coming in a future post. \u00a0But before this, I was using ntp to get time accurate to a handful of milliseconds, usually. \u00a0Now, my accuracy and stability has improved by a few of orders of magnitude, with errors measured in single-digit microsecond (millionths of a second) levels. That&#8217;s far more accurate than I need for any practical reason, but it&#8217;s nice to have, anyway.\u00a0 It was amazingly simple and cheap to achieve this level of accuracy.<\/p>\n<p>How did I do it?<\/p>\n<p>I purchased a Raspberry Pi 3 model B, an Adafruit\u00a0 Ultimate GPS Hat, and the case.\u00a0 The GPS hat required a bit of simple through-hole soldering to attach the header to the board.\u00a0 The rest went together very simply.\u00a0 Once I got it all together, I powered up the Raspberry Pi even before I placed an SD card into the Pi, and I left it outdoors, so it could &#8220;see&#8221; the satellites and obtain a GPS lock.<\/p>\n<p>As I left the GPS outside getting locked onto the satellites, I downloaded the latest Raspbian Stretch image, and burned it onto an SD card.\u00a0 I changed the boot directory of the SD card image, and put a file named &#8220;SSH&#8221; there (contents don&#8217;t matter, mine was zero bytes long).\u00a0 This allows me to get into the Pi using the &#8220;ssh&#8221; program. Then I disconnected power from the Raspberry Pi, inserted the SD card, and booted up.<\/p>\n<p>I went to my router&#8217;s status page to find out the address of my new Pi, and used ssh to connect to it, using the default user &#8220;pi&#8221; and default password, &#8220;raspberry&#8221;.\u00a0 I immediately changed the password, expanded the SD card image to fill the entire disk, set a static IP address, set a hostname, updated the software using &#8220;aptitude update&#8221; and &#8220;aptitude upgrade&#8221;, installed emacs (my favorite text editor), and basically got myself a basic bare-bones headless Raspberry Pi on my home network.<\/p>\n<p>Once I did that, I went through the basic checkout and setup of the Adafruit GPS hat, as listed here: \u00a0<a href=\"https:\/\/learn.adafruit.com\/adafruit-ultimate-gps-hat-for-raspberry-pi\/\" target=\"_blank\" rel=\"noopener\">https:\/\/learn.adafruit.com\/adafruit-ultimate-gps-hat-for-raspberry-pi\/<\/a><\/p>\n<p>Finally, I set up the Pi with GPS hat as a Stratum-1 time server, using the following instructions and script, by the legendary hacker Eric S. Raymond: \u00a0<a href=\"https:\/\/www.ntpsec.org\/white-papers\/stratum-1-microserver-howto\/\">https:\/\/www.ntpsec.org\/white-papers\/stratum-1-microserver-howto\/<\/a><\/p>\n<p>There is a lot of detail in that page, but the &#8220;Clockmaker&#8221; script handled the dirty work very effectively.<\/p>\n<p>How well does it work?\u00a0 It stays pretty accurate, but if you watch for a while, you may notice some fluctuations as the computer&#8217;s quartz oscillator speeds up and slows down with the daily temperature fluctuations, and the ntp software steers the clock to correct as best it can.\u00a0 You can see the current offset and jitter of my ntp server right\u00a0<a href=\"\/timeserverstatus\">here!<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>My computers now know what time it is, to the millisecond, without using the Internet. I put together a stratum-1 ntp time server, based on a Raspberry Pi 3 model B with an Adafruit Ultimate GPS Hat. \u00a0I put the whole thing into a\u00a0C4 Labs Zebra GPS HAT Case, made of layers of shiny acrylic. <a class=\"more-link\" href=\"https:\/\/ag6qr.net\/index.php\/2018\/09\/04\/what-time-is-it\/\">Read More &#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":493,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,6],"tags":[],"class_list":["post-492","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-computers","category-electronics"],"_links":{"self":[{"href":"https:\/\/ag6qr.net\/index.php\/wp-json\/wp\/v2\/posts\/492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ag6qr.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ag6qr.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ag6qr.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ag6qr.net\/index.php\/wp-json\/wp\/v2\/comments?post=492"}],"version-history":[{"count":8,"href":"https:\/\/ag6qr.net\/index.php\/wp-json\/wp\/v2\/posts\/492\/revisions"}],"predecessor-version":[{"id":621,"href":"https:\/\/ag6qr.net\/index.php\/wp-json\/wp\/v2\/posts\/492\/revisions\/621"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ag6qr.net\/index.php\/wp-json\/wp\/v2\/media\/493"}],"wp:attachment":[{"href":"https:\/\/ag6qr.net\/index.php\/wp-json\/wp\/v2\/media?parent=492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ag6qr.net\/index.php\/wp-json\/wp\/v2\/categories?post=492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ag6qr.net\/index.php\/wp-json\/wp\/v2\/tags?post=492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}