I want to write about something lighthearted, nerdy, and fun this week. What better than the concept of time? To a nerd like me, time is a fun concept that’s full of contradictions and paradoxes. It seems simple, straightforward, and painfully easy to understand, but I’ll bet you’ve never considered deeply how time works, both in the abstract sense and in the sense of how we use time. It’s simultaneously totally concrete (five minutes is five minutes, and it’s the same five minutes for everyone, everywhere, always, right?) and extraordinarily abstract (the idea of time as a fourth dimension, or enormous spans of time like the lifetime of the universe). Time is both something we as a society understand thoroughly and intuitively, and also something we’ve only scratched the surface of understanding (relativity and spacetime, and the idea of time travel). It’s also a critical part of the Spacemesh protocol, which is another reason I think about it so much. Here are three ways in which time is particularly fascinating and weird.
Thing #1: Arbitrary
"There are decades where nothing happens; and there are weeks where decades happen" - Lenin
Every unit of time, from the largest to the smallest, is completely arbitrary. Historical time measurements such as the day (one rotation of earth), the month (one revolution of the moon around the earth), and the year (one revolution of the earth around the sun) all make intuitive sense in their own right but these units don’t actually match scientific reality and they hardly map to one another cleanly. A year is approximately but not exactly 365 days long. A day is almost but not exactly 24 hours long. The month is even more complicated! A month is actually around 29.53 days, but it can vary by up to seven hours (and there are, in fact, at least five competing definitions of the term month!).
And why are there 24 hours in a day or 7 days in a week or 60 seconds in a minute or 60 minutes in an hour? These are even more arbitrary choices that have nevertheless emerged as near-universal standards due to accidents of history, convenience, and cultural momentum (historically, different cultures chose different systems but the strongest memes won).
Of course, as fun as these questions are to ask and as interesting as it is to ponder history, in a day to day sense they don’t matter at all. When you tell someone that your son is ten years old or that you lived in London for three months it doesn’t matter that those units aren’t precisely defined. But it’s not fine for scientific usage, where precision matters and where being off by even a tiny factor can result in catastrophe. This has led over time to absurd redefinitions of time units along more precise lines, such as this SI definition of a second:
The second [...] is defined by taking the fixed numerical value of the caesium frequency, ΔνCs, the unperturbed ground-state hyperfine transition frequency of the caesium 133 atom, to be 9192631770 when expressed in the unit Hz, which is equal to s−1.
Things get even more absurd when we consider timezones. On the face of it these make sense: the sun obviously rises and sets at different times in different places, so shouldn’t we adjust the time from place to place so that sunrise and sunset occur at roughly the same time everywhere? In fact this is more or less how ships measure time when communicating, adjusting their clocks gradually and evenly as they travel east or west without political considerations. (As an aside, interestingly enough we don’t apply the same standard to months. July is summer in the northern hemisphere and winter in the southern hemisphere and we just sort of deal with it, and qualify when necessary with phrases like “northern hemisphere winter.” If we wanted we could choose to do the same thing with time of day: imagine “Beijing morning” or “Delhi evening.”)
But this is not how timezones work in practice. Not even close. While this idea was the original motivation for the establishment of timezones, in practice they’re almost purely political. China famously uses a single timezone (Beijing time) despite the fact that it spans more than three thousand miles east to west. The sun rises and sets hours later in western China than it does in the east, so that a 6am sunrise in Beijing means a 8am sunrise in Urumqi. In practice, businesses in the west often keep two clocks, one set to “official” Beijing time and one set to a more practical local time; the ethnic Chinese population mostly uses Beijing time and the Uighur population mostly uses Xinjiang time, despite the fact that they live in the same place! And if you cross from western China to Afghanistan the clock jumps back 3.5 hours. If you instead cross to India, it jumps back 2.5 hours, and if you cross to Nepal it jumps 2.25 hours. Why are Afghanistan, India, and Nepal off the rest of the world by 30 minutes and 45 minutes? Historical reasons.
This is just one small geographical corner in a vast world of temporal weirdness. There are multiple cities divided into different timezones, and even one such capital city. Israelis and Palestinians living in the same place use slightly different timezones. I could go on for quite a while! There are countless other such examples from around the world—which is a big part of why I find time in general, and timezones in particular, so fascinating! It’s not just that such weirdness exists on such a scale, but also the idiosyncratic human stories that led to the weirdness arising. Unlike, say, agricultural practices or basket weaving, time is an especially visible cultural artifact.
And all of this weirdness is to say nothing whatsoever of the subjective experience of time, which is of course even weirder and more arbitrary. Time flies when you’re having fun 🙂
Thing #2: Computers
“Time zone and daylight-saving rules are controlled by individual governments. They are sometimes changed with little notice, and their histories and planned futures are often recorded only fitfully. Here is a summary of attempts to organize and record relevant data in this area.” - IANA tz database
As described above, while humans can be fuzzy and hand-wavy with time, scientists and computers can’t. And time isn’t always straightforward to work with. Knowing the current time is hard enough: According to which system? Which timezone? Relative to which starting point? Which units? Etc. Knowing what time it was at some point in the past is harder, since rules can and do change all the time (e.g., answering the question, “What was the time 1bn seconds ago?” is not as easy as it sounds). Knowing the time at some point in the past in a different place is even harder. And hardest of all—even though it sounds simple—is calculating the difference between two points in time.
I’ll bet you’ve never considered how or why this is difficult. It should come as no surprise to a computer scientist since we’re used to trying to represent fuzzy real world systems in cold, hard code. Again, the challenge has to do with the fact that the rules change all the time. As a result—wait for it, I’m about to blow your mind—time is actually two-dimensional. There’s what time we think it was 1bn seconds ago at this moment, and there’s what time we think it was 1bn seconds ago 1bn seconds from now. These may be different. (For the record this also assumes that everyone everywhere agrees about these values. Given that time is political, and they don’t, this is not really a given so time may in fact be three-dimensional.)
In other words, to interpret even the most basic time arithmetic, we need context. We need to know which set (or sets) of rules we’re using to perform the arithmetic. The full set of information we need to thoroughly and correctly calculate the difference between two points of time is: What’s the timezone at the starting point, what’s the timezone at the ending point, and what is the entire set of changes to the timezones or rules at both points between the start and end point?
To give you a sense of how insanely complex this is, take a look at the IANA timezones database, which is the most complete database that exists on this topic. It’s updated more than once a day and doesn’t even claim to be complete or totally accurate. Here are the most recent release messages:
Mar. 28: Model Lebanon's DST chaos by reverting data to tzdb 2023a
Mar. 24: Lebanon delays the start of DST this year
Mar. 24: Egypt now uses DST again, from April through October. This year Morocco springs forward April 23, not April 30. Palestine delays the start of DST this year. Much of Greenland still uses DST from 2024 on. America/Yellowknife now links to America/Edmonton. Starting in 2023, Egypt will observe DST from April's last Friday through October's last Thursday. Assume the transition times are 00:00 and 24:00, respectively. In 2023 Morocco's spring-forward transition after Ramadan will occur April 23, not April 30. Adjust predictions for future years accordingly. This affects predictions for 2023, 2031, 2038, and later years. This year Palestine will delay its spring forward from March 25 to April 29 due to Ramadan. Make guesses for future Ramadans too. Much of Greenland, represented by America/Nuuk, will continue to observe DST using European Union rules. When combined with Greenland's decision not to change the clocks in fall 2023, America/Nuuk therefore changes from -03/-02 to -02/-01 effective 2023-10-29 at 01:00 UTC. This change from 2022g doesn't affect timestamps until 2024-03-30, and doesn't affect tm_isdst until 2023-03-25.
(It goes on, and on, and on, over decades, and every line is fascinating because it tells a human story. The first two lines above alone speak volumes!)
Note the use of terms like “assume”, “predictions” and “guesses”. This is what happens when you try to represent something as fuzzy as human consensus and nation state governance in code. Unlike humans, computers absolutely need to know how to uniquely refer to any given point in subjective time. If two points in time have the same description then it’s as if time repeats itself, which can lead to all sorts of issues with systems, including both operating systems and distributed systems. If even one second is skipped, this can also cause problems.
As a very simple example, if you tell a computer only to let someone attempt to login X times per hour, what do you do twice a year when daylight savings time starts or ends, when an hour either repeats itself or totally disappears? As programmers we have to handle all of these edge cases. Standard time libraries in modern programming languages help a lot and attempt to manage a lot of these cases for us but at the end of the day it’s on the programmer to write smart algorithms and programs that handle time correctly and account for every case including the corner cases.
This matters in all systems, but it’s doubly true in distributed systems. Time matters a great deal in Spacemesh, given that proofs of spacetime are a fundamental building block of the protocol. Spacemesh nodes need to know precisely when a new layer starts down to the millisecond so they have time to construct and gossip blocks to the network, receive and process incoming messages in time, etc.
I ran into some of these issues recently when trying to calculate the Spacemesh issuance model. I wrote a tool that, given a genesis date, prints the issuance schedule arbitrarily far into the future (Spacemesh continues to issue coins for over a thousand years post-genesis). I had to deal with all sorts of complicated questions and corner cases. For instance, how do you precisely define a year? How do you slice up issuance into months and years when it actually occurs in five minute layers, which don’t actually fit evenly into months and years (due to the misalignments I described above)? This doesn’t matter so much day to day or even year to year, but over the span of millennia it matters a lot. Errors accumulate over long timespans.
For more of a sense of just how weird, complicated, and fascinating time can be in the world of computing, check out Time zone and daylight saving time data (from the same IANA database I linked above) and this gem of a YouTube video.
Thing #3: Relativity
"One thing I have learned in a long life: that all our science, measured against reality, is primitive and childlike—and yet it is the most precious thing we have." - Einstein
As if that weren’t all weird, complicated, and fascinating enough, we haven’t even gotten to the truly weird stuff yet. In 1905 during his annus mirabilis Einstein published his theory of special relativity, which reconciled two postulates that are contradictory in classical physics: that the laws of physics are the same for two observers in the same inertial frame of reference, and that the speed of light is constant for all observers regardless of their frame of reference. The only possible way to reconcile these two postulates is to recognize that time itself passes differently for two observers in two different inertial frames of reference (time dilation).
This simple yet seemingly strange, confusing observation eventually upended hundreds of years of thought and theory on physics, mechanics, and many other fields. It also led to a number of other strange, related postulates, including the fact that space and time are not independent as previously assumed but are in fact inseparably joined, that you cannot establish the fixed sequence of events occurring in two different places (relativity of simultaneity), and the equivalence of energy and mass, the famous E = mc2.
Honestly, I could end this section and this article here because it just doesn’t get any weirder than this. It’s hard to think of an accepted scientific theory weirder or with more far-reaching implications than the theory of relativity. And yet relativity operates at cosmic scale and seems to have no practical consequence for every day life on earth. So, like me, you probably consider it a strange, confusing concept that’s fun to think about from time to time but you probably don’t give it much heed and you probably haven’t spent much time trying to understand it.
I think this is a naive, unhelpful way of thinking about the matter for a few reasons. The first is that, in fact, like the arbitrarily-defined time units and crazy, confusing timezones described above, relativity does have a number of important implications and concrete use cases in modern society. In fact, we all use it every day in the form of tools like atomic clocks and GPS. These tools—time synchronization and location determination—wouldn’t work correctly if they didn’t factor in relativistic effects. This will only increase as our computers and other tools operate at higher and higher precision and as we travel and communicate over greater distances at greater speeds (as seems obvious we will). If relativity is already important in communicating with near-earth orbit satellites, how much more important its role in communicating with colonies on the Moon, Mars, or further afield?
Another reason relativity is interesting and important is because of the way in which it represents a neat paradigm shift, one of the biggest and most important in the history of science (up there with the germ theory of disease and the theory of evolution). It demonstrates that science is never finished, even when we have solid, tested, well understood theories that seem complete and seem to explain how pretty much everything around us works. How many of our existing theories will seem equally naive once another Einstein comes along and proves us all wrong again? We will figure out more things and it will enable us to do things we couldn’t previously imagine—perhaps, someday, even faster than light travel or time travel. In any case, in a sense relativity demonstrates that we cannot say with absolutely certainty that these things will never come to pass (even as relativity says that maximum speed is finite).
Relativity is difficult to stomach because it seemingly flies in the face of reason. How can it be that we cannot assign a definite sequence to two events that aren’t causally related, or that time will subjectively appear to pass differently for two observers in different frames of reference? And yet these ideas are true and have been proven to be so hundreds of times through experiments conducted all over the world. There is no single accessible reality, universal across all of space and time, not even for something as fundamental as space or time itself. It should give us pause and make us consider how we know, or think we know, the things we know, and how wrong we might be about even the most basic ideas. I find this a helpful, powerful, humbling idea.
Finally, relativity is important because it’s beautiful. It has an inherent, underlying aesthetic and it demonstrates a sense of beauty and humor on the part of the universe, or the creator, or the Dhamma, whatever you want to call it. It gives me a strong sense that there’s a fundamental design at work on the cosmic scale, a method to the madness if you will. This is manifest in the interconnectedness of space and time and the oneness of mass and energy. It’s visible in the stunning simplicity of Lorentz symmetry, in the way spacetime curves around massive objects, and in hard limits like the fact that information cannot under any circumstances travel faster than the speed of light, which means gravitational effects travel at the speed of light as waves (fun to try to visualize, isn’t it?). And let’s not forget about the weirdest and most wonderful of all physical phenomena. The black hole, which was predicted by Einstein and which we now know actually exists, represents the unknowable within an otherwise complete system (since energy, matter, and information that cross the black hole’s event horizon can never escape). It seems that God left us a few Easter eggs out there in the cosmos and we’ve begun to find them—how many more are out there?