Eventhacker
Knowledge / Network / Timing & Synchronisation

Time Synchronization in Networks

Two devices may both claim to run at exactly 48 kHz and still slowly drift apart. Networked media systems therefore need more than a shared time-of-day: they need a common clock.

1. Oscillator Drift & The Problem

Every digital audio or video interface relies on a clock generator (oscillator). Due to physical manufacturing tolerances and thermal variations, no crystal oscillator operates at 100.0000% nominal speed.

Device A (Stagebox):  48,000.02 Hz
Device B (Console):   47,999.98 Hz

The difference of 0.04 Hz means Device A produces 4 more audio samples every 100 seconds than Device B can consume. Without synchronization, receiver buffers will eventually overflow or run dry.

Practical Consequences: Buffer underruns/overruns, micro-clicks, audio dropouts, loss of framing synchronization, and slow A/V drift.

2. Time-of-Day vs. Media Clock

In network engineering, it is essential to distinguish between timestamping events and clocking digital media reproduction.

Time-of-Day (NTP)

Question: "What time is it?"

  • System clocks & log files
  • Millisecond precision (1–10 ms)
  • Typical protocol: NTP (Network Time Protocol)

Media Clock (PTP)

Question: "When exactly does the next sample occur?"

  • Digital Audio (Dante, AES67, ST 2110)
  • Sub-microsecond precision (< 1 µs)
  • Technology: PTP (IEEE 1588)
Eventhacker Memory Aid

NTP tells you what time it is. PTP helps devices agree on exactly when "now" happens.

3. How NTP Works

NTP exchanges UDP packets containing four timestamps between client and server to estimate network delay and clock offset:

Client                                  Server
T1  -------- Request ----------------->
                  Request Received      T2
                  Response Sent         T3
T4  <------- Response -----------------

By comparing (T4 - T1) and (T3 - T2), NTP estimates round-trip delay and calculates system clock offset. Because software timestamps are generated in kernel/user space, asymmetry and OS scheduling jitter limit NTP precision to milliseconds.

4. IEEE 1588 PTP & Hardware Timestamping

PTP (Precision Time Protocol) achieves nanosecond/microsecond accuracy by bypassing OS stack jitter using Hardware Timestamping directly at the physical network interface (PHY/MAC).

               PTP Leader (Grandmaster)
                           |
         +-----------------+-----------------+
         |                 |                 |
         v                 v                 v
     Stagebox           Console             Amp
   (Follower)         (Follower)        (Follower)

Through Best Master Clock Algorithm (BMCA), devices select a PTP Leader (Grandmaster). Followers measure path delay via Sync & Delay_Req messages and continuously steer their local clock hardware.

5. Packets Do Not Need Equal Delay

A common misconception is that audio IP packets must arrive at strictly equal time intervals. In reality, network packets experience jitter:

Packet 1 arrival:  0.3 ms delay
Packet 2 arrival:  0.7 ms delay
Packet 3 arrival:  0.4 ms delay
Key Takeaway

PTP tells the receiver when the media should be reproduced. The network only has to deliver the data before that deadline.

6. Frequency Steering (The DJ Analogy)

Synchronized devices do not repeatedly jump their clock back and forth. Jumping causes harsh audio distortion. Instead, Phase-Locked Loops (PLL) continuously adjust oscillator frequency.

DJ Beatmatching Analogy: Just like a DJ gently adjusts pitch control until two tracks run perfectly in sync without resetting the needle, PTP micro-adjusts clock speed to match the Grandmaster.

From the History

Early computers needed synchronized wall clocks (NTP). Later, digital audio required separate Word Clock BNC cables. Modern IP networks combine clock and data over standard Ethernet.

Read History: From NTP to PTP Next: Analyzing PTP with Linux