SPDX-FileCopyrightText | SPDX-License-Identifier | title | author | footer | description | keywords | color | class | style | ||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
© 2024 Menacit AB <[email protected]> |
CC-BY-SA-4.0 |
Logging course: Time and clocks |
Joel Rangsmo <[email protected]> |
© Course authors (CC BY-SA 4.0) |
Introduction to time and clock challenges in logging course |
|
#ffffff |
|
section.center {
text-align: center;
}
table strong {
color: #d63030;
}
table em {
color: #2ce172;
}
|
IT systems rely on time and clocks for a wide variety of important tasks.
Authentication protocols, banking applications, industrial control systems...
Allows us to correlate events/activity in different computers and the real world.
What kind of time?
Wall time / Real time.
Most computers count number of seconds elapsed since the first of January 1970 (UTC).
Commonly called "UNIX time"/"Epoch".
Converted into local time/calendar date by OS/applications.
Await the horrors of 2038!
Something something the sun and moon.
In the late 1800s, physicists tried to properly define a second.
Atomic clocks measure the resonant frequency of atoms very precisely.
Since 1968, BIPM defines it as ~9 billion frequency transitions of Cesium 133 at -273 Celsius.
Sounds quite straightforward, doesn't it?
You're not getting away that easily.
Let's talk about time zones and dates...
You wanna eat lunch around 12, right?
Not straight lines, quite a lot of politics involved.
Important to keep track of if we're operating internationally.
Everyone Many of us love a bit of sun,
but hates being confused.
Not everyone changes at the same time.
Many plan to get rid of it, few have succeeded.
Let's make it more exciting!
Some time zones differ by 30 or 45 minutes.
Some places don't even want 24 hour days.
Why not throw in leap years and leap seconds?
These are not static things and can change (back and forth) over time.
Not just the Gregorian calendar.
Must be remembered when performing time calculations.
Is all hope lost?
Are we doomed to live in a confusing time warp?
Could any somewhat sane person wrap their head around this?
Let's meet Arthur David Olson and Paul Eggert.
Dataset and reference code for working with international calendar time.
Continuously updated to match an ever-changing world.
Maintained by ICANN since 2011.
Many different formats exist for dates and timestamps.
Which part is the year, month and day? What time zone are we talking about?
Some are more/less readable by humans and machines alike.
Okay okay - Time is messy but important, we get it!
- All clocks show the same time
- All clocks show the right time
In theory, if we solve the second we should automatically solve the first.
In practice, this is tricky - just trust me for now.
Let's start with the first problem...
Network Time Protocol.
Standard for clock synchronization. Actively developed since 1980s.
Replicates time over UDP port 123. Uses bag of tricks to calculate and adjust for network delay.
Mitigates clock drift/skew.
- ntpd
- NTPsec
- OpenNTPD
- chrony
- systemd-timesyncd
Some only implement SNTP.
Plain-text protocol* vulnerable to Man-In-The-Middle attacks.
Precision typically limited to milliseconds.
Network Time Security.
Uses TLS and PKI to exchange key for symmetric authenticated encryption.
Extension to NTP, like HTTPS for HTTP.
Limited software support and a bit more resource intensive than plain NTP.
Precision Time Protocol.
Version 2 can synchronize clocks with ~nanosecond precision.
Enabled by special handling in Network Interface Cards and Operating Systems.
Our clocks are in sync!
Let's focus on the second problem...
In the basement of BIPM, atomic clocks tick to define...
Universal Time Coordinated.
How does my time server know what the correct time is?
Ask another one perhaps?
- Dedicated signaling cable
- Radio broadcast
- Satellite navigation system (GNSS)
- Locally connected atomic clock
Clocks break, radio communication can be spoofed/jammed and NTP peers may lie.
What's the solution?
Use multiple sources and calculate an average!
Kool - let's grab some time!
Used as default by many operating systems and IoT appliances.
Run by volunteers, anyone* can join and contribute!
Region specific aliases, like "se.pool.ntp.org", can be used in attempts to find servers nearby.
Cloudflare and NIST provide good alternatives/complements.
Also known as the Swedish Distributed Time Service.
Funded by PTS and operated by Netnod.
Provides highly accurate time via Anycast from several redundant sites spread over Sweden.
Relies on an open-source FPGA-based for NTP and NTS. Offers PTP.
Wanna geek out on time?
Join the annual Netnod Tech Meeting!