A brief history of time that most programmers should know

Have you ever wondered what is “time” really is?
At the core of it, time is a measure of a day, split into 24 hours or 86400 seconds in a cycle. We use it to organize our activities. It is a marker on the stretch of the day when our job would start and end. It is omnipresent. Existed as long as we can remember and feels like a natural part of our life. Similar to the air we breathe. We don’t think about it, time is just there.
What if I told you that time is ever-changing and not always reliable?
To understand why, we have to go back a bit over a hundred years ago, when time was already tracked using clocks.
It is 1845 and pocket watches are in style. The seconds ticks for these watches are dictated by a balance wheel. The accuracy was not that great and the ticks change depending on numerous factors, such as the energy reserve left in the main spring and the position of the watch. Therefore, the watches need to be synchronized with the local church or clock tower1. One can imagine, that time differs from town to town2. Timezone was still not a thing yet.
1847, due to trains, people were moving faster between towns. Each town having time differences starts to get annoying and GMT was introduced to standardized time across Britain. Up to 1955, a second was defined to be 1/86400 of a mean solar day, which depended on, among other things, the rotation of the earth3. The rotation of the earth is not constant (surprise!). It changes ever so slightly, generally getting slower4. 300-400 million years ago, an earth day was shorter and a year had 400 days5.
If the earth’s rotation is inconsistent, then how can we get a reliable definition of day? Cue for Ephemeris time! Back then, the predicted time of planets and moons contradicted with observation6. Either the moon and all the planets were unstable or the earth was not spinning evenly. The latter was a more reasonable assumption. Since the position of other celestial bodies, such as the sun and the moon, are predictable, they can be used to define a day and hence time. Which is the whole premise of Ephemeris time. Therefore, in 1952, an Ephemeris second was measured against the orbit of the earth around the sun. In practice though, the observation of the moon was used because it was faster and more accurate to get results7.
The atomic clock was developed in 1955 and three years later, the atomic second was defined based on the Ephemeris Second, with measurements done between 1955-1958. The Era of Atomic Time began. But, adoption would not happen until many years later.
The International System of Units, which defines SI units such as meter and kilogram, adopted the Ephemeris second as the SI Second in 1956. The UTC, successor to GMT, time signal was first broadcasted in 1960. A second in UTC is the same as a second in atomic clock, which is constant. But, a day in UTC has to match a measured earth’s day8 called UT1, which depends on the rotation of the earth.
Notice the many definitions of time so far? Well, the drama continues.
The atomic second is fixed and the number of seconds per day and per year is also fixed for atomic time keeping. But, the rotation of the earth varies and generally getting slower. Therefore, an earth day is slowly getting longer. The length of the earth day and the atomic time were bound to get out of step. “Rubber” second9 was introduced to address this, and clocks around the world had to adjust their rates once a year.
Meaning, the second that ticks on the clock is not always a fixed length. Unless it is an atomic clock.

Finally, in 1967, SI adopted the Atomic second as standard. Another year, another change. “Rubber” second was causing some annoyance, which was to be expected. Five years later, in 1972, Leap Second was introduced to supersede the “rubber” second. UTC will then have a fixed number of atomic second per year, unless it drifts too far from the measured value in UT1, then a leap second can be added or removed. Between 1972-2023, there were 27 seconds added, not including the 10 seconds drift before the leap second introduction.
The atomic clock won and it solved all our time problems!
If only life was that easy. There is a physics concept called Time Dilation, where time elapses slower at higher velocity or stronger gravity. You might remember this from the film Interstellar. To spice things up, the earth’s gravity is not constant throughout its surface, it differs slightly from location to location. Therefore, an atomic clock placed on top of a mountain might be running at a different rate than the one in a valley. To overcome this, multiple atomic clocks are placed in various location and the average measurement is taken as the definitive value.
Because of the size and cost of an atomic clock, not everyone could have them. So where does the time on our phones and computers comes from?
Lo and behold, Network Time Protocol (NTP) came into existence in the early 1980s. It takes the value from atomic clocks and synchronizes it around the world. An enormous amount of effort was put into developing and maintaining both the protocol and the infrastructure. Nevertheless, it cannot defeat the final boss: physics and the speed of light. No synchronization can be instantaneous, and a few milliseconds drift is expected between the time kept by the Atomic Clock and what you see on your computer or phone right now.
On 18 November 2022, the General Conference on Weights and Measures (CGPM) resolved to eliminate leap seconds by or before 203510.
And so, the time saga continues :)
https://en.wikipedia.org/wiki/Local_mean_time
https://www.rmg.co.uk/stories/topics/time-greenwich-mean-time-confusing-case-travellers-watch
https://en.wikipedia.org/wiki/Second#Fraction_of_solar_day
https://en.wikipedia.org/wiki/Earth%27s_rotation
https://www.distributed-systems.net/index.php/books/ds3/
From Sundials to Atomic Clocks
https://en.wikipedia.org/wiki/Ephemeris_time#Secondary_realizations_by_lunar_observations
https://mperdikeas.github.io/utc-vs-ut1-time.html
From Sundials to Atomic Clocks
https://en.wikipedia.org/wiki/Leap_second#International_proposals_for_elimination_of_leap_seconds