Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Meta Engineering 12 min read Deep dive hardMaster

Open-sourcing a more precise time appliance

Meta built and open-sourced the Time Card, a PCIe card combining a multiband GNSS receiver, a miniaturized atomic clock and an FPGA time engine that turns a commodity x86 server with a hardware-timestamping NIC into an NTP/PTP Stratum 1 time appliance. The FPGA disciplines a 125 MHz clock derived from the rubidium oscillator against GNSS PPS using a PI control loop with 250 ps resolution, and the card keeps holdover within 1 µs per 24 hours if GNSS is lost. Setup uses the Linux 5.15+ driver, chrony's PHC refclock and phc2sys. Calnex Sentinel measurements showed NTP within ±40 µs, PTP in the nanosecond range, PPS error within ±200 ns and 24-hour holdover drift under 300 ns. Specs, schematics, BOM and code are released through the OCP Time Appliance Project.

Assumes: NTP and PTP basicsHardware timestamping on NICsClock oscillators and PPS signals

Related posts

  • PTP: Timing accuracy and precision for the future of computing

    Meta Engineering easyNovice

    Meta is rolling out Precision Time Protocol (PTP) across its data centers to replace NTP, moving clock synchronization precision from milliseconds to nanoseconds. Accurate offset measurement depends on network latency being consistent and symmetric, so PTP uses hardware timestamping to improve consistency and transparent clocks to improve symmetry. Meta removed boundary clocks so every machine syncs directly with the Server Clock. Because off-the-shelf gear could not handle PTP at its scale, Meta built its own Time Appliance (a GNSS receiver plus a miniaturized atomic clock) and a PCIe Time Card, and has open-sourced the hardware, client software and transparent clock through the Open Compute Project.

  • How Precision Time Protocol is being deployed at Meta

    Meta Engineering hardMaster

    Meta replaced NTP with Precision Time Protocol across its data centers to get nanosecond-level clock sync. Its main motivating use is commit-wait reads that bound clock uncertainty and avoid quorum reads, which ran roughly 100x better on PTP than on NTP in Meta's experiments. The design has three parts. The PTP rack has GNSS-over-fiber antennas and OCP Time Cards disciplined by oscillatord, with NIC clocks aligned via ts2phc and PPS to within ±50ns. The network uses unicast PTP with transparent clocks instead of boundary clocks. Clients are served by ptp4u, an open-source Go PTP server handling over 1 million clients per appliance, with c4u generating dynamic clock class and accuracy and Calnex Sentinel independently monitoring the setup.

  • Simple Precision Time Protocol at Meta

    Meta Engineering hardMaster

    Simple Precision Time Protocol (SPTP) replaces the subscription-based unicast PTPv2 exchange with a stateless, client-driven three-packet exchange: a delay request (flagged with PTP profile Specific 1), a sync carrying T4, and a followup/announce carrying T1 and CF1. Standard two-step PTP formulas then give path delay and offset. Because the client drives the exchange, it can poll several servers at once and combine them into a clock ensemble. That ensemble rejects outliers using Chauvenet's criterion over 400 samples and weights the remaining clocks by inverse variance. At Meta scale SPTP matches ptp4l precision while cutting CPU by over 40%, memory by 70% and network traffic by 50%, at the cost of losing subscription signaling and authentication.

  • How Precision Time Protocol handles leap seconds

    Meta Engineering mediumAdept

    Meta handles leap seconds for its nanosecond-precision PTP service by self-smearing inside the fbclock library, which shifts its returned Window of Uncertainty {earliest_ns, latest_ns} by 1 ns every 62.5 µs. The approach is stateless and reproducible, since the start time comes from tzdata, so a rebooted server can recompute its position. The service keeps TAI internally and returns UTC through the API. The costs are that linear PTP smearing and quadratic NTP smearing can disagree by over 100 µs, hosts still drift apart during the smear, and precisely scheduled jobs end up nearly 1 ms off after 60 seconds. Meta therefore recommends that clients use TAI where possible and supports freezing new leap seconds after 2035.

  • Three Clocks are Better than One

    TigerBeetle mediumAdept

    TigerBeetle builds a fault-tolerant "cluster time" by measuring clock offsets to peers during keepalive probes. Each offset combines the peer's wall-clock timestamp with half the round-trip time, and the best low-latency samples from windows of up to 20 seconds are fed to Marzullo's algorithm, which yields bounds agreed by a majority of clocks. That lets a server correct its system time when NTP silently fails, or shut down safely if too many clocks are faulty. Elapsed time should be measured with CLOCK_BOOTTIME rather than CLOCK_MONOTONIC, which stops counting during system suspend (e.g. VM migration), or CLOCK_MONOTONIC_RAW, which exists for NTP to measure oscillator drift.

The quest for software engineering knowledge.

Look:
Layout: