What Every Developer Should Know About Time 1807: the Noon Gun Starts firing a Time Signal in Cape Town, South Africa [Bis79]
Total Page:16
File Type:pdf, Size:1020Kb
1 What every developer should know about time 1807: The Noon Gun starts firing a time signal in Cape Town, South Africa [Bis79]. This allows ships in the port to check the accuracy of their marine chronometers. Marine chronometers Martin Thoma are used on ships to help calculate the longitude. E-Mail: [email protected] 1825: The Stockton and Darlington Railway opened [Tom15]. This raised the need for synchronized times for train schedules Abstract—This paper introduces basic concepts around time, started to rise. Often, the time of a big city like Berlin was including calendar systems, time zones, UTC and offsets. It gives chosen. This was then called Berlin Standard Time. a brief historic overview of systems that are applied to simplify the understanding. 1838: Telegraphy made time synchronization possible [TM99]. 1876: After missing a train, Sir Sandford Fleming proposes I. INTRODUCTION to use a 24-hour clock. So instead of distinguishing 6am and 6pm, he proposes to distinguish 6 o’clock and 18 o’clock. Time is such a fundamental concept that we rarely think about 1884: Sir Sandford Fleming proposed a worldwide standard it in detail. When one is forced to develop software or analyzes time at the International Meridian Conference to which 24 time data generated by software, one needs to understand the edge ◦ zones of 360 = 15◦ latitude are added as local offsets. This cases. This paper is a short introduction to those concepts and 24 way, the local time at each place would be at most half an edge cases. The paper is inspired by [Sus12a], [Sus12b] and hour off from the standardized time and simplify the system John Skeet’s talk at NDC London in January 2017. (see Figure 5). That conference accepted a different version of The target audience of this paper are computer scientists and Universal Time but refused to accept his zones, stating that they developers. There are many more details relevant to historians were a local issue outside its purpose. In this conference, the like other calendar types, units of time such as Danna [Eng88] prime meridian was defined to be the Royal Observatory, or techniques like radiocarbon dating. While this paper touches Greenwich, United Kingdom. many topics, I recommend [Sei05] for details. 1891: The Prussian railway replaced Berlin time with Central European Time (CET) as a common time [Bar07]. II. A BRIEF HISTORIC OVERVIEW 1893: The Imperial German government adopted CET for all The history of time and dates is driven by religious beliefs, state purposes [Bar07]. economic interests, technological advances and navigation. 1916: The German Empire introduces Daylight Saving One of the oldest types of time measurement is measuring the Time [vD16]. apparent solar time by sundial. In sundial time, the time of 1924: The Greenwich Time Signal is introduced as a way to the day when the sun reaches the local meridian is defined as synchronize time [McI90]. 12:00 [Ste07]. 1955: The International Time Bureau (BIH) began a time 1500 BC: Oldest known sundial was created [Bor11]. scale using both local Caesium clocks and comparisons to 46 BC: The Julian Calendar was proposed. In the Julian distant clocks using the phase of VLF radio signals [GA05]. Calendar, every 4th year is a leap year. This means a Julian year is 365.25 days, which is also used as the basis for a light 1956: The United States Naval Observatory began the A.1 scale year [Wil89]. The Julian Calendar brought the 12 months in using a Caesium standard atomic clock [For85]. line with the seasons. 1959: DCF77 started service as a standard-frequency station. 1582: The Gregorian calendar was introduced to counter 1960: The Coordinated Universal Time (UTC) was intro- seasonal drift [Wik18b]. It was desired that the Christian duced [McC09]. holiday of Easter is on spring equinox - the day, when there is an equal time of daytime and nighttime are of approximately 1967: The SI second was defined in terms of the Caesium equal duration all over the planet. To keep equinox around atom (see Section III). Based on this exact definition, the Temps 20 March and 22–23 September, every 4th year is a leap year Atomique International (TAI) is calculated by the International except for every 100th year. But every year that is divisible by Bureau of Weights and Measures (BIMP). 400 is again a leap year. 1968: The Universal Time No.1 (UT1) was introduced as a 1712: Sweden wanted to gradually change from the Julian successor of Greenwich Mean Time (GMT). It is based on Calendar to the Gregorian calendar by skipping leap years astronomical observations such as the mean solar time. In for 40 years. During the Great Northern War, however, they the same year, the definition of a second was changed from didn’t skip the leap years in 1704 and 1708. To restore the astronomical observations to atomic clocks. Julian Calendar, they had to add another day. As 1712 was 1972: The first leap second was introduced [Leaa]. already a leap year, they added February the 30th, making it a double-leap year [dou]. 1986: The work on the IANA time zone database began. 2 III. UNITS IV. MEASURING AND SYNCHRONIZING TIME Within desktop computers are real time clocks (RTCs) which The SI base unit for time is a second. A second is historically are powered by a small battery. RTCs are chips which contain defined as the fraction 1 of the mean solar day. [Bro16] 60·60·24 a crystal oscillator. Often Quartz is used, because it is cheap, defines it more formally by a physical process: uses very little power and is accurate. It can gain or lose up clock The second is the duration of 9 192 631 770 peri- to 15 seconds every 30 days. This phenomenon is called ods of the radiation corresponding to the transition drift. between the two hyperfine levels of the ground state Today, many operating systems use the Network Time Protocol of the cesium 133 atom. (NTP) to get the current time via internet. The used time servers can have more accurate sources like atomic clocks. The Other time units are based on the second: protocol also compensates network latency. Over the public −9 −6 • All SI-prefixes, especially 1 ns = 10 s, 1 µs = 10 s, internet it is accurate within a few tens of milliseconds. On and 1 ms = 10−3 s. Applications in physics can go down local networks it can be reduced to less than 1 ms. A set of to an attosecond (10−18 s) [HKS+01]. atomic clocks throughout the world keeps time by consensus. This is defined to be the International Atomic Time (TAI). • 60 seconds are one minute. For a security in NTP, see [DSZ16]. • 60 minutes are one hour. The Precision Time Protocol (PTP) focuses on higher accuracy • 24 hours are one standard day. The word “standard” than NTP within local networks. It is standardized in IEEE 1588. is important here, for example when you think about If PTP is implemented in hardware it can reach errors of Daylight Saving Time. less than 10 ns [Wei12] and implemented in software within milliseconds [GE17]. According to [Wei12], PTP is used to A 360◦ rotation of earth is called a sidereal day, while the noon coordinate measurement instants, to measure time intervals, as to noon rotation is called a solar day. Due to the movement of a reference to determine the order of events and the age of Earth around the sun, this is not the same. Neither a sidereal data items. day nor a solar day are of the same length as the standard day. An sidereal year is the time it takes Earth to orbit around V. CALENDARS the sun with respect to fixed stars. A solar year is the time it takes the sun to return to the same position in the cycle of The Julian calendar only had one leap day every 4 years making seasons as seen by Earth. As the axial precession has a cycle the average year have 365.25 standard days. Comparing it to the 365.24219 standard days of a tropical year, the Julian of 25 722 years [dIV18], the difference between a sidereal year standard day 365·24·60 min − : and a solar year is about ≈ 20 ). calendar has an error of 0 00781 tropical year and the solar 25722 year days shift from the standard days by one day every 128 years. A calendar year is an approximation of either a solar year, Today, we use the Gregorian calendar in most parts of the a sidereal year or different systems like lunar years. A lunar world. It is named after Pope Gregory XIII, who introduced it month is the time it takes the moon to orbit around the earth. in October 1582. It uses leap years to make the average year Similar to the calendaric definitions based on Earths rotation 365+ 1 − 1 + 1 = 365:2425 days long, by inserting a leap around the sun, there are different lunar months depending on 4 100 400 day at the end of February every fourth year except for every how a full rotation around the Earth is defined. A calendar 100th year except for every 400th year. The Gregorian calendar month is an approximation to it. A day is the time it takes has an error of −0:00031 standard day and thus the shift is earth to rotate around it’s axis. tropical year only one day every 3226 years. This is a major improvement And that is where we get problems: All of the calendar units compared the Julian calendar which was used before.