More Software Engineering Radio episodes

SE Radio 749: Sachin Singh on the Network Time Protocol thumbnail

SE Radio 749: Sachin Singh on the Network Time Protocol

Published 2 Dec 2026

Duration: 48:27

NTP synchronizes computer clocks using atomic references and latency calculations, ensuring accuracy for critical systems like GPS, databases, and authentication protocols.

Episode Description

Sachin Singh, former software engineering lead for time synchronizsation at AWS, discusses the Network Time Protocol (NTP) -- a key protocol for commu...

Overview

NTP is a fundamental protocol that keeps computers synchronized over the internet. Without external synchronization, a computer's quartz crystal can drift by three to four seconds a day, compounding to minutes over a year. Atomic clocks, which lose about a second in 50 to 100 million years, serve as the reference time source, and NTP defines how to retrieve time from them. Servers and data centers do not rely on superior hardware in each machine; instead, they synchronize to atomic clocks via NTP.

Accurate timekeeping is critical across many applications. GPS breaks at nanoseconds, trading applications at microseconds, databases at milliseconds, two-factor authentication at seconds, OAuth and JWT at minutes, and TLS certificates at hours. The NTP protocol operates over UDP and accounts for network latency by recording four timestamps (t0 through t3), assuming symmetric travel time. Clients like chrony make sixteen requests by default, discarding high-latency responses.

The infrastructure follows a strict stratum hierarchy, from stratum zero (atomic clocks) through stratum fifteen, with stratum sixteen indicating unsynchronized. Major cloud providers run internal NTP services for their data centers, while public pools are maintained by volunteers and government institutes. Practical lessons include storing UTC with timezone information and monitoring the offset metric, which was maintained at 500 to 800 microseconds in the AWS implementation discussed.

What If

  • What if you add a time-offset metric to your existing monitoring dashboard?

    • Move: Run the chrony command that prints your current offset and pipe that value into your CloudWatch, Grafana, or Datadog dashboard, setting an alert threshold below your application's tolerance.
    • Why Now?: The source notes that offset is "the single most important metric in ntp" and that most developers never look at it until a failure occurs; adding it now is a low-effort, high-visibility safeguard.
    • Expected Upside: You would detect gradual drift before it crosses the threshold where two-factor codes expire (15 or 30 seconds) or JWT tokens become invalid, potentially catching issues hours before user-facing breakage.
  • What if you switch your application's time source to your cloud provider's internal NTP endpoint instead of a public pool?

    • Move: Configure your VMs to use the provider's internal time service (e.g., the Amazon-internal NTP endpoint) rather than a public ntp.pool.org address, removing the need for outbound internet rules.
    • Why Now?: The source explains that public pools offer no accuracy guarantee and that using an internal endpoint eliminates firewall holes, which is especially relevant if you are tightening VPC security groups.
    • Expected Upside: You would reduce dependency on volunteer-maintained servers, keep traffic inside your VPC, and gain access to provider-managed accuracy (the AWS fleet discussed held 500 to 800 microseconds), lowering the chance of a stratum-sixteen surprise.
  • What if you refactor your database schema to store every timestamp as UTC plus an explicit timezone field?

    • Move: Add a timezone column alongside each UTC timestamp in your persistence layer and ensure your API responses carry both values, letting the client or browser convert to local time.
    • Why Now?: The source highlights that missing timezone data is a "major thing" causing incorrect reporting across client, server, and user zones, and that browsers already expose the user's local timezone for display.
    • Expected Upside: You would eliminate a class of reconciliation bugs where events appear out of order or in the wrong day, reducing support tickets and making audit trails unambiguous.

Takeaway

  • Enable automatic time synchronization on every machine you manage (the "get time automatically" checkbox on macOS/Windows, or ensure chrony is running on Linux) so you never rely on an unsynced quartz crystal drifting three to four seconds a day.
  • Add your chrony-reported offset as a metric on your monitoring dashboard and set an alert threshold appropriate to your application's tolerance, catching drift before it breaks authentication or ordering logic.
  • Point your cloud-hosted VMs at your provider's internal NTP endpoint rather than a public pool, eliminating outbound firewall rules and gaining provider-guaranteed accuracy.
  • Persist every timestamp in UTC and store the originating timezone alongside it; let the presentation layer or browser handle local conversion to avoid cross-zone reconciliation errors.
  • Configure your NTP client pool to reject stratum-sixteen responses automatically, and set an operational alert if more than a small fraction of your time servers report stratum sixteen, so you can replace them before clients lose synchronization.

Recent Episodes of Software Engineering Radio

25 Nov 2026 David Denton on http4k

HTTP 4k is a functional Kotlin toolkit for web applications that enables fast, in-memory testing of entire systems by modeling servers and endpoints as simple, composable functions.

29 Oct 2026 Danilo Krummrich on Rust in the Linux Kernel

"Nova GPU driver project integrates Rust into the Linux kernel to replace the aging Novo driver, leveraging Rust's memory safety for better reliability and performance while addressing firmware and architectural challenges through incremental, collaborative updates."

7 Oct 2026 Sahil Walia on Schema Changes and Data Migrations

Recommended: Schema as source of truth

"Schemas define data structure, apply across systems, and require careful evolution to avoid breaking changes, with best practices including additive updates, blue-green deployments, and stable identifiers."

30 Sept 2026 Raju Dandigam on Building Production AI Agents

"Explores production AI agents, their autonomy, safety, and engineering best practices, comparing workflows, tool design, orchestration, and memory systems while addressing challenges like cost, latency, and reliability."

More Software Engineering Radio episodes

SE Radio 749: Sachin Singh on the Network | Podcast Summarizer · sni1