Physical Clock
Physical clocks, clock skew, and synchronization protocols.
A physical clock (also called wall-clock time) is the real-world time maintained by a machine’s hardware clock, typically expressed as: YYYY-MM-DD HH:MM:SS
Physical Clock
Time Moving Backwards
Network Latency and Synchronization
Clock drift is the gradual divergence of a machine’s clock from real time due to hardware imperfections. All hardware clocks rely on quartz oscillators. They are not perfectly accurate. Typical drift: 10–100 ppm (parts per million) That’s several milliseconds per second
Clock skew is the difference between two machines’ clocks at a specific moment. Example: Server A → 10:00:05 Server B → 09:59:58 Skew = 7 seconds
When a machine syncs time with a time server: It sends request Server replies with current time Network delay exists But: We don’t know exact one-way delay We only know round-trip time So clock adjustment is an approximation. example: Client asks time. Round trip = 40 ms. Assumes 20 ms one way. But actual: Outgoing: 10 ms Return: 30 ms Clock is now 10 ms wrong.
When synchronizing using Network Time Protocol (NTP): If system clock is ahead, NTP may adjust time backward. Example: Current time → 10:00:10 NTP correction → set to 10:00:05
WHERE WE USE PHYSICAL CLOCKS? 1. Logging & Monitoring ELK stack Observability systems 2. TTL (Time-To-Live) Cache expiry Session expiry Token expiration Example: Redis keys JWT tokens 3. Rate Limiting Example: 100 requests per minute Uses wall clock time