Unix

A Brief History of Time

Noooooo – a different Brief History of Time…

Time is important; so important that it’s epic! Or epoch more specifically. The epoch is a date and time from which a computer measures the time on the system. Most operating systems derive their time from the number of seconds that have passed since January 1st, 1970 when the clock struck midnight. Why? Because this is when time began – likely the Catch-22 the movie, which came out later that year was made based on this fact. As with most things awesome in computing, this came from Unix. More specifically, taken from Unix Epoch time. 

MATLAB uses January 0, 1BC – which is all you need to know about Matlab developers, really. COBOL used January 1, 1601, likely indicating that was the year Cobol was written. OK so it isn’t – but I’m guessing it’s when many of the philosophies of the language were first conceived. Time must seem like it started on January first 2001 to Apple’s Cocoa framework, which began epoch then. My least favorite would be AmigaOS, which started Epoch time on January first 1978 – Nothing good happened in 1978. Jaws 2 and Halloween were released that year. Yuck. Well, Animal House was pretty good. But I could do without Boogie Oogie Oogie. And I could do without Andy Gib’s Shadow Dancing. Disco died the next year. As did the soul of anyone that had to use an Amiga.

Due to how many modern encryption protocols work, you want to keep time in sync between computers. A skew, or offset in that time by even microseconds can impact the ability to decrypt data. Most real-time clocks are based on crystal oscillators, similar to those found in clocks on a wall. These drift over time. Computers that were initially synchronized to the same time can have pretty different system times after even just a few hours.

This lead to the Network Time Protocol, or NTP for short. NTP NTP was designed by David L. Mills of the University of Delaware. networking protocol that provides for clock synchronization between computer systems over standard data networks. NTP has been running since 1985, making it one of the oldest Internet protocols still in use today, with the most updated specs defined in RFC 958. 

`date +%s`

NTP has had a number of updates over the years, although they have slowed as it became more popular. NTP 0 was released in 1985, the same year as the Goonies, Pale Rider, the Breakfast Club and ironically Back to the Future. Given that NTP was free, it’s also ironic that Dire Straits released Money for Nothing the same year it was released. Simple Minds, Aha, and Tears for Fears ruled the airwaves that year, with Tears for Fears proving that Everyone wants to rule the world, but despite being free, NTP is the one on all computers, thus outlasting the rest and being the one that ended up ruling the world. 

Version 1 came in 1988, 2 in 1989, , 3 in 1992, and NTPv4 was drafted in 2010 but has not yet been published given how dependent we as an IT industry now is on NTP. Just looking at how dependent we are, let’s look at the three main platforms:

  • In Windows, you can just “Double-click the system clock and then click on the Internet Time tab.” 
  • On Mac, open System Preferences > Date & Time which configures the /usr/libexec/timed launchdaemon
  • And on Linux, open System > Admin >Time and Date. These screens allow you to enter an NTP Server. NTP is short for Network Time Protocol. NIST Internet Time Service (ITS) provides 24 names of Network Time Servers, and each vendor often operates their own, such as time.apple.com. Each machine then operates a time zone offset. You know Apple’s time servers because you can read them plain as day by default if you cat /private/etc/ntp.conf – it just outputs server time.apple.com. I’d tell you how to do it in Windows but it would blow your mind. OK, I’ll do it anyways: Just reg query HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters and then read the value of the NtpServer field in the output. OK, not mind blowing. But what is mind blowing?

The Big Bang is mind blowing. Not the TV show; that’s 

NTP uses 64-bit timestamps. Those consist of a 32-bit portion used for seconds and a 32-bit portion used for a fraction of a second, meaning that it rolls every 232 seconds, which is 136 years. NTPv4 will still need to get ratified by February 7th, 2036, if only to cover the first rollover. NTPv4 moving to a 128-bit date format should take us until the next Big Bang when this stuff won’t matter any more. 

Mills was an interesting cat. He got his PhD in Computer Sciences from the University of Michigan in 1971, where he worked on ARPA projects wrote terminal software that provided connections to the IBM360 mainframe. He also worked on the Exterior Gateway Protocol. He initially invented NTP in 1981 and was a professor in computer science at the University of Delaware from 1986 to 2008. He’s still an emeritus professor at the University of Delaware. 

In 1610 (a few years after the COBOL epoch), the English naval officer Samuel Argall named the Delaware River and Delaware Bay after then governor of Virginia, Thomas West. West happened to be the 12th Baron De La Warr. Did you know that Delaware was the first state to ratify the constitution on December 7th 1787? Delaware is the diamond state, and the second smallest state in the Union. The state insect is a lady bug. Ryan Phillippe is probably more famous than NTP, even though he killed disco with his awful acting in Studio 54. Henry Heimlich is from Delaware. Hopefully you don’t need to use his infamous maneuver as often as NTP gets updated. Elisabeth Shue is also from Delaware. The Karate Kid was awesome. But that’s it. No one else of note. Joe Biden, Senator from Delaware from 1973-2009 and Vice President from 2009 to 2017 – he’s not from Delaware, he’s from Scranton. In case you’re curious, that’s not in Delaware. 

Following the retirement of Mills from the University of Delaware, the reference implementation is currently maintained as an open source project led by Harlan Stenn, who has submitted bug fixes and portability improvements to the NTP codebase since the 1980s. He’s been allowed to focus on time because of the Network Time Foundation, which can be found at https://www.nwtime.org. What’s next for NTP? For one, ratifying NTS. 

Network Time Security (NTS), draft RFC 7384, lets users or servers authenticate to the Network Time Protocol (NTP). This involves a key exchange over TLS that protects against man in the middle attacks, using standard PKI as well as a TLS handshake that then allows time synchronization via extension fields. 

NTP isn’t the only time protocol. Others have come and gone. PTP is one, used to sync clocks. Originally defined in 2002 and updated in 2008 – PTP wasn’t backwards compatible though. Always a challenge. Especially when PTP was meant to displace NTP for GPS-style communication.

The Global Positioning System, or GPS for short, is a satellite based system that provides positioning, navigation and timing services. GPS is owned and maintained by the US military and comprised of 24 satellites orbiting the earth. These are arranged in such a way that at least four can be seen from anywhere on Earth. Each has an atomic clock that gets synchronized with a master back home on terra. Time is important to GPS because the satellite position and broadcast time are used to triangulate time and location for devices.

The future of time is uncertain. But given how long since the last major update, it’s likely that NTP will be with us even after Galactus survives the next Big Bang so he can create Nova.