Menu
O mnie Kontakt

Prawie każdy zegar na świecie jest zły. Zegar na Twoim telefonie, zegar na laptopie, a nawet zegar w starym Nintendo DS, które trzymasz w szufladzie, jest nieprecyzyjny. Co dziwniejsze, wszystkie te zegary są zaskakująco bliskie rzeczywistej godzinie. Zegar na Twoim komputerze może być od najbardziej precyzyjnych atomowych zegarów na świecie oddalony zaledwie o kilka dziesiątych milisekundy. Taki poziom synchronizacji czasowej jest niezbędny, aby wiele kluczowych systemów mogło funkcjonować poprawnie. Bez tego, nowoczesne sieci energetyczne mogłyby się załamać, rynki finansowe rozpaść, a licytacje na eBayu stałyby się nieuczciwe. Dla wielu z nas, kluczowym elementem, który utrzymuje wszystko w ryzach, jest niewidoczny internetowy system stworzony 40 lat temu przez jednego człowieka w Delaware, który wciąż istnieje dzięki zaangażowaniu bardzo miłych nerdów.

Warto zauważyć, że Twój komputer potrafi utrzymywać czas bez dostępu do internetu, nawet gdy jest wyłączony lub nic nie jest podłączone. Posiada on mały zegar na płycie głównej, zasilany niewielką baterią, który pozwala mu utrzymywać wewnętrzny zegar przez okres od 5 do 20 lat. Jednak w świecie dokładnych zegarów, to nie jest najlepszy zegar – naturalnie przestaje chodzić o kilka sekund każdego dnia i nie jest na bieżąco z informacjami, jak na przykład czy Międzynarodowa Służba Rotacji Ziemi i Referencji zdecyduje, że w tym roku 31 grudnia trwa 86 400 sekund albo 86 401 sekund. Dlatego komputer musi w końcu skorzystać z dokładniejszych źródeł czasu – zegarów, które można nazwać bardziej „wprawionymi”..

Aby dokonać synchronizacji czasowej z niemal 100% dokładnością, używamy protokołu Network Time Protocol (NTP), jednego z najstarszych zestawów reguł regulujących działanie internetu. Ciekawostką jest to, że w internecie istnieje zaledwie 19 rzeczywistych źródeł dotyczących tego, która godzina jest aktualna. Wymaga to od NTP, aby ustanowić hierarchię zegarów. Topową warstwą hierarchii NTP, Stratum Zero, są konkretne zegary, uznawane za najbardziej dokładne na świecie i mające ostatnie słowo w aktualnym czasie na Ziemi. Obecnie internet korzysta z 19 zegarów Stratum Zero, zlokalizowanych w Niemczech, Szwajcarii, Francji, Wielkiej Brytanii, Japonii, Hawajach, Ontario, Kolorado, Marylandzie i przestrzeni kosmicznej.

Nie wszystkie źródła czasu działają w ten sam sposób. Większość z nich to państwowe stacje nadawcze sygnału czasowego, takie jak ta w Fort Collins w Kolorado, która jest używana do kalibracji wszelkich zegarów radiowych w Ameryce Północnej. Emituje sygnał czasowy w nadzwyczaj dokładnych 60-sekundowych blokach, które dokładnie oznaczają początek każdej minuty. Zegar Stratum Zero obejmuje również kilka systemów satelitarnych, takich jak GPS i Galileo, które w razie potrzeby także mogą dostarczyć nowe dane do systemu. Zakładając, że oglądasz ten film w Stanach Zjednoczonych, zegar, z którym zsynchronizowany jest Twój komputer, prawdopodobnie znajduje się w małym, jednopiętrowym budynku w Północnym Kolorado.

Gdy czas zostaje przekazywany, współdziała ze sobą kilka serwerów. Każdy zegar Stratum Zero łączy się bezpośrednio z serwerem Stratum One. Liczba tych serwerów jest ograniczona, ale są one najbliższe perfekcyjnej dokładności. Serwery Stratum Two to komputery, które otrzymują czas bezpośrednio od serwerów Stratum One. Ogólnie rzecz biorąc, serwery Stratum Two są najbardziej dostępnymi dla ogółu ludzi. Obliczeniowe serwery czasu, takie jak time.windows.com, są zazwyczaj serwerami Stratum Two. Komputer, na którym oglądasz to wideo, prawdopodobnie znajduje się w Stratum Three i to nie jest powód do wstydu – czas na nim jest jedynie kilka milisekund nieaktualny w stosunku do zegara atomowego w Kolorado. Cała ta skomplikowana rzeczywistość jest możliwa dzięki sprytnemu systemowi hierarchicznemu, który radzi sobie z czasem i synchronizacją. Warto dodać, że w momencie pisania tego artykułu, film na kanale Half as Interesting ma 889124 wyświetleń i 32022 polubień, co świadczy o zaangażowaniu jego widzów w tematykę synchronizacji czasu.

Toggle timeline summary

  • 00:00 Prawie każdy zegar na świecie jest niedokładny.
  • 00:14 Czas twojego komputera jest ściśle zsynchronizowany z zegarami atomowymi.
  • 00:31 Krytyczne systemy polegają na precyzyjnej synchronizacji czasu.
  • 00:42 Niewidoczny system internetowy utrzymuje dokładność czasu.
  • 01:02 Twój komputer ma niezależny zegar zasilany baterią.
  • 01:37 Komputery muszą synchronizować czas z dokładnych źródeł.
  • 01:48 Protokół czasu sieciowego jest kluczowy dla synchronizacji czasu.
  • 02:29 Zegary Stratum Zero są najdokładniejszymi zegarami na świecie.
  • 02:48 Na całym świecie jest 19 zegarów Stratum Zero, wszystkie obsługiwane przez rządy.
  • 03:22 Państwowe stacje radiowe sygnału czasowego kalibrują zegary.
  • 03:45 Systemy satelitarne również przyczyniają się do hierarchii pomiaru czasu.
  • 04:00 Twój komputer prawdopodobnie synchronizuje się z źródłem czasu w Północnym Kolorado.
  • 04:21 Serwery Stratum One łączą się z zegarami Stratum Zero.
  • 04:32 Serwery Stratum Two polegają na Stratum One dla dokładnego czasu.
  • 05:04 Każdy zegar okresowo sprawdza się względem swojego zegara źródłowego.
  • 05:38 Komputery używają znaczników czasu do obliczania dokładnego czasu.
  • 06:28 Czas wyświetlany na twoim ekranie jest wynikiem złożonej infrastruktury.
  • 07:05 Wprowadzenie do Trade Coffee jako sponsora oferującego lepsze opcje kawy.
  • 07:24 Osobiste doświadczenia z Trade Coffee zwiększające przyjemność z kawy.
  • 07:47 Promocja Trade Coffee dla wygodnego doświadczenia z kawą.

Transcription

Almost every clock in the world is wrong. The clock on your phone is wrong, the clock on your laptop is wrong, the clock on that old Nintendo DS in your closet that somehow still has battery is wrong, but what's weirder is that they're all really bizarrely close to being right. If you look at the time on your computer right now, that time is probably only a few dozen milliseconds away from the most precise and advanced atomic clocks in the world, and there's a good reason for that. Without this level of granular time synchronization, any number of hugely important systems would fall apart. We wouldn't be able to operate modern power grids, financial markets would disintegrate, and eBay bidding would get really unfair. And like a lot of modern critical infrastructure, the only thing keeping this all together is an invisible internet system that you probably didn't even know existed, which was created 40 years ago by one guy in Delaware, and only still exists because of a bunch of very nice nerds who have decided to let society keep functioning. Just an aside, it's worth pointing out that your computer can keep the time without the internet, and it can even do that when off, unplugged, or full of bees. Basically, there's a small clock somewhere on your motherboard that's powered independently by a little battery that looks like this, and it has enough juice to keep your computer's internal clock running on its own for somewhere between 5 and 20 years. But in the world of big buff clocks, this is not a particularly great clock. It'll naturally drift by a few seconds each day, and it's not up to date on the latest time news, like whether or not the International Earth Rotation and Reference System Service has decided that this year's December 31st will be 86,400 seconds or 86,401 seconds. So all that is to say, your computer needs to, at least sometimes, get its time from somewhere else—a clock that actually hits the gym. But getting the time from here to here with nearly 100% accuracy is easier said than done, so here's how it's done. It's called the Network Time Protocol, and it's one of the oldest sets of rules governing how the internet actually works. You see, the internet only has 19 real sources for what time it is—I know that sounds weird, more on that later—so it needs a system to get the time from one of those clocks to every other device on the internet. And you can't just have millions of computers all hooked up directly to those clocks, so instead, the internet is built on top of a secret clock hierarchy. Some computers have more accurate time than others—it's fresher, closer to the teat of a real clock. But if you want to move your computer up in clock society, you'll need to understand how this hierarchy works. The top layer of the Network Time Protocol, which is called Stratum Zero, are the actual clocks themselves. These are, generally, some of the most accurate clocks in the world, and they're the final authority for what the time on Earth actually is at any given moment. As of right now, the internet is hooked up to 19 of the Stratum Zero clocks located in Germany, Switzerland, France, the UK, Japan, Hawaii, Ontario, Colorado, Maryland, and space. And as far as I can tell, every single one of these time sources is owned or operated by some kind of government agency—usually one of those really obscure government agencies that's just, like, three guys in a room who care a frightening amount about calibrating clocks and absolutely nothing else. Their websites look like this, their logos were designed in Microsoft Word 25 years ago, and most of them seem to spend their free time organizing and attending what I would describe as a shocking number of different timekeeping and measurement conventions. Now, not all of these time sources work the same way—most of them are state-run time-signal radio stations, like this one in Fort Collins, Colorado. The signal broadcast by this station is used to calibrate pretty much any radio-controlled clock in North America. It operates its own set of cesium-fountain atomic clocks on-site—don't worry about what that actually means, just know that they're really good clocks—and broadcasts a constant time signal in perfect 60-second blocks that precisely denote the start of each minute. Stations like this cover most of the Earth, but Stratum Zero also includes a few satellite systems like GPS and Galileo which have their own atomic clocks, and can also throw some fresh numbers into the system when necessary. So okay, assuming you're watching this video in the United States—which you are, because that's the only country—the clock your computer is actually synced to is almost certainly located in this small, one-story building in Northern Colorado. But how does the time get from there to you? Well, the short answer is, time goes through wire. The slightly less short answer is that the data needs to travel through a few different servers before it reaches you. This is where the other strata come in. Every Stratum Zero clock is connected directly to a Stratum One server. There are a fairly limited number of these, and they're as close to being perfectly accurate as a computer can be without literally being the clock itself. Stratum Two servers, then, are the computers that get their time directly from Stratum One servers. Since you can't really make your own Stratum One server without direct access to an atomic clock, Stratum Two servers are generally the most accurate computers available to the general public. Commercial time servers—like, say, time.windows.com, which is the default time source for Windows computers—are usually in Stratum Two. And that means that, unless you've gone and done something weird, the computer you're watching this video on is probably in Stratum Three, and that's nothing to be ashamed about. It's probably only a few milliseconds off from that atomic clock all the way over in Colorado, which is only possible because the time travels down each one of these levels in a really clever way. Basically, each clock at each level is counting time on its own, and it only checks its daddy level every so often to see if it's wrong, so it can adjust to the right time and keep counting from there. But when a computer requests the time from the computer above it, there's a bit of a physics problem. It takes time for the question to get from one computer to another, time for the computer to process the question, and time for the answer to go back, and by then, who really knows what time it is. So, instead of just saying, hey daddy computer, what time is it, and rolling with whatever answer it sends back, there's a way to get a much more accurate answer. First, the computer asking the question will record what time it thinks it is when it first asks the question—that's T0. It'll send T0 to the computer above it, who will record the time that it actually is when it receives the question—that's T1. Then it'll record the time again when it sends the answer—that's T2, and finally the first computer will record the time when it receives the answer—that's T3. Using these four timestamps, you can figure out what the difference is between the two computers' clocks—that's just T1 minus T0—but you can also figure out how much time it takes for the signal to travel between both computers using this formula here, which I won't really explain, but I promise it makes sense if you look at it for long enough, and that allows you to adjust the first clock without worrying about the latency of the internet and physics and stuff. So there you go! The tiny number in the corner of your screen is an incredible feat of infrastructure, physics, and math. And frankly, this video was an equally incredible feat, because my writer Ben went to college for something called Literary Arts, and now he's using the last section of the script to beg me to not make him write another video involving numbers, and blah blah blah, it just keeps going on like that. Well, I guess that's the end of the video, then. See you next time! But actually, before you go, I made Ben run the numbers on one last piece of convoluted math, and his results were definitive. You're paying too much for coffee. I know it, you know it, we all know it. Everyone pays too much for coffee, because honestly, grocery store coffee is usually pretty gross, and the one other option is shelling out like $8 for a latte every morning. But now you've got a third option, thanks to our sponsor, Trade Coffee. Trade partners with over 55 of the best indie roasters in the country to deliver fresh, delicious coffee beans right to your door, and better yet, they work with you to match you with the perfect roast that fits your palate. Before I started using Trade, I didn't really know anything about coffee. I'd just take whatever was available and dump a bunch of sugar in it. But now, I can actually enjoy the coffee itself, and I actively look forward to trying new roasts that Trade matches me with. Lately, I've been enjoying Oren's Special Blend, which Trade determined works well over ice and is roasted to take cream, both of which I enjoy because I drink my coffee like a tiny little baby. So, if you want to skip the coffee shop, upgrade your morning routine with Trade Coffee. Visit drinktrade.com to sign up and save $15 on select plans, and better yet, you'll get your first bag of coffee for free.