[LF] Physical Clocks
This is a series of notes on topics related to Local-First software.
Physical Clocks
- Measure time in seconds.
- Types:
- Analogue/mechanical clocks (pendulum-based).
- Digital clocks (quartz crystal-based).
- Found in watches, computers, phones, appliances.
- Also called wall clocks (even if not on a wall).
Quartz Clocks
How They Work
- Quartz crystal laser-trimmed to resonate at a specific frequency.
- Piezoelectric effect: Converts mechanical force ↔ electric field.
- Oscillator circuit produces signal at resonant frequency.
- Count cycles to measure elapsed time.
Limitations
- Drift: Inaccuracies due to manufacturing & temperature changes.
- Drift measurement: Parts per million (ppm).
1 ppm = 1 μs/s = 86 ms/day = 32 s/year
.- Most computer clocks correct within
~50 ppm
.
Atomic Clocks
- More accurate than quartz clocks.
- Based on quantum-mechanical properties (e.g., caesium-133, rubidium).
- SI second definition:
9,192,631,770 periods
of caesium-133’s resonance. - Accuracy:
~1 in 10¹⁴
(1 second error in 3 million years).
Time Standards
- International Atomic Time (TAI):
- Pure atomic time (ignores Earth’s rotation).
- Greenwich Mean Time (GMT):
- Originally solar time at Greenwich meridian.
- Coordinated Universal Time (UTC):
TAI + leap seconds
to match Earth’s rotation.
Leap Seconds
- Added to UTC to align with Earth’s rotation.
- When: 30 June or 31 December at
23:59:59 UTC
.- Positive leap second:
23:59:60
inserted. - Negative leap second:
23:59:59
skipped.
- Positive leap second:
- Impact on software:
- Unix time: Ignores leap seconds (counts seconds since 1 Jan 1970).
- ISO 8601: Includes timezone offset.
Key Takeaways
- Quartz clocks are common but drift.
- Atomic clocks & GPS provide high accuracy.
- UTC balances atomic time & Earth’s rotation via leap seconds.
- Software often ignores leap seconds (edge cases exist).