# PTP and Network Time Sync

> How the Precision Time Protocol (IEEE 1588) and NTP put room cameras and recording computers on one clock: clock roles and master election, hardware versus software timestamping, linuxptp (ptp4l, phc2sys, ts2phc), chrony as the fallback, checking that GigE cameras have locked, and scheduled action commands for exposure sync over Ethernet.

Page: https://egocam.ai/sync/ptp-and-network-time/

Current head rigs keep their own cameras in step with wires, not networks. RoboCap's six-camera hat, for example, exposes all six cameras "from a single PWM frame-synchronization signal generated by the main controller and fanned out through a 1-to-6 clock buffer" ([Ali et al., 2026](https://arxiv.org/abs/2610.07217)), and Meta's Ego-1K rig surrounds a Quest 3 headset with "12 synchronized cameras" ([Lee et al., 2026](https://arxiv.org/abs/2603.13741)). That is [hardware sync](https://egocam.ai/sync/hardware-sync/), and it stays on the wearer.

Network time solves the problem around the wearer: fixed room cameras in an [ego-exo](https://egocam.ai/basics/ego-vs-exo/) capture space, depth sensors, and several recording computers that each stamp their own sensors. This page goes deeper into the Precision Time Protocol (PTP) and its Linux tools, chrony as the fallback when PTP hardware is missing, and how Ethernet machine-vision cameras use PTP to expose together. The overview, with accuracy figures for every method, is on [software and visual sync](https://egocam.ai/sync/software-and-visual-sync/#ntp-chrony-and-ptp) and [sync methods compared](https://egocam.ai/sync/sync-methods-compared/). Terms such as offset, drift and jitter are defined on [why synchronisation matters](https://egocam.ai/sync/why-sync-matters/#terms-used-in-this-section).

## Terms used on this page

For the field guide's terms in one place, grouped by topic, see the [glossary](https://egocam.ai/reference/glossary/).

| Term | Meaning |
| :--- | :--- |
| PTP (IEEE 1588) | A protocol that synchronises clocks over Ethernet by exchanging timestamped messages. Cameras and Linux tools implement IEEE 1588-2008, "also known as PTP Version 2" ([Basler](https://docs.baslerweb.com/precision-time-protocol)). |
| Grandmaster clock | The root time source of a PTP network, "often receiving highly accurate time information from sources like Global Positioning System (GPS) or atomic clocks" ([e-con Systems](https://mvpromedia.com/e-con-systems-the-role-of-precision-time-protocol-synchronisation-in-ethernet-cameras/)). |
| Ordinary clock | An end device with one PTP port, such as a camera or a recording PC. |
| Boundary clock | A device with several PTP ports, such as a PTP switch, that takes time from upstream on one port and serves it on the others. |
| Transparent clock | A PTP switch that forwards PTP messages and corrects them for the time they spent inside it. `ptp4l` implements end-to-end and peer-to-peer variants ([ptp4l(8)](https://linuxptp.nwtime.org/documentation/ptp4l/)). |
| PHC (PTP hardware clock) | A clock on the network card itself. With hardware timestamping, PTP packets are stamped by this clock as they are sent and received ([Red Hat](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ptp_using_ptp4l)). |
| Synchronise and syntonise | PTP does both: it sets each local clock "as precisely as possible to the time of the master clock", and adjusts its frequency so that "the duration of a second" matches ([Basler](https://docs.baslerweb.com/precision-time-protocol)). |
| E2E and P2P delay | The two ways PTP measures path delay: end-to-end ("delay request-response") between each device and the master, or peer-to-peer link by link ([Basler](https://docs.baslerweb.com/precision-time-protocol)). |
| One-step and two-step | In one-step operation "one message is sent", carrying its own departure timestamp; in two-step operation a second message carries the timestamp ([Basler](https://docs.baslerweb.com/precision-time-protocol)). |
| ARB timescale | The arbitrary timescale a PTP network runs on when no device follows world time (TAI or UTC). |
| Scheduled action command | A GigE Vision 2.0 command that tells cameras to act, for example to start an exposure, at a given future PTP time. |

## How PTP disciplines a network of clocks

Without sync, each camera counts from power-on on its own crystal. Sony's engineers describe the result for networked cameras: "these time stamps gradually go out of synchronization as time passes owing to discrepancies in the clocks' frequencies" ([Eikawa, 2017](https://www.vision-systems.com/articles/print/volume-22/issue-4/features/integration-insights-ieee1588-simplifies-camera-synchronization.html)). PTP exchanges timestamped messages with the master clock and corrects both the offset and the rate of every other clock.

> **Diagram:** The IEEE 1588 delay request-response exchange. Four timestamps, two taken on each clock, give both the path delay and the camera's offset from the master, which the camera then corrects. The maths assumes the delay is the same in both directions, which is why non-PTP switches that queue packets unevenly show up as offset error.

### Which clock becomes the master

The devices elect a master automatically. Basler: "The master clock is determined by several criteria. The criterion with the highest precedence is the device's Priority 1 setting", and "The network device with the lowest Priority 1 setting is the master clock" (the full rules are in IEEE 1588-2008, clause 7.6.2.2). On Basler ace 2 and dart M cameras, `BslPtpPriority1` can be set "between 0 (highest priority) and 255 (lowest priority)" to force or prevent a camera becoming master; on other Basler models it "is preset to 128 and can't be changed" ([Basler](https://docs.baslerweb.com/precision-time-protocol)). To make a Linux PC or a GPS grandmaster win, give it a lower Priority 1 than the cameras.

### PTP time is not wall-clock time

A PTP network agrees with itself, not necessarily with the world. Basler: "If no device in the network is synchronized to a coordinated world time (e.g., TAI or UTC), the network will operate in the arbitrary timescale mode (ARB). In this mode, the epoch is arbitrary, as it is not bound to an absolute time." SVS-Vistek makes the same point: "If a fixed relation to the real world time is to be established, a separate device based on Network Time Protocol (NTP) or Global Positioning System (GPS) must take over the function of the master" ([SVS-Vistek](https://web.archive.org/web/2026/https://www.svs-vistek.com/en/knowledgebase/svs-about-machine-vision.php?p=ptp-766)). If you need to line PTP-stamped room video up with devices on other clocks, either feed the grandmaster from GPS or NTP, or add a [visual sync event](https://egocam.ai/sync/qr-and-visual-sync/) that every device sees.

Two details matter when writing capture software for GigE Vision cameras ([Basler](https://docs.baslerweb.com/precision-time-protocol)):

- **Timestamp width.** "IEEE 1588 defines 80-bit timestamps for storing and transporting time information. Because GigE Vision uses 64-bit timestamps, the PTP timestamps are mapped to the 64-bit timestamps of GigE Vision."
- **Tick rate.** "On ace Classic/U/L cameras, enabling PTP clock synchronization changes the camera's internal tick frequency from 125 MHz (= 8 ns tick duration) to 1 GHz (= 1 ns tick duration)"; "On other cameras, the tick frequency is always 1 GHz." Code that converts ticks to seconds must know which applies.

## Hardware timestamping and the network

PTP's accuracy depends on where packets are timestamped. Red Hat: "Hardware PTP support provides better accuracy since the NIC can time stamp the PTP packets at the exact moment they are sent and received while software PTP support requires additional processing of the PTP packets by the operating system." With hardware support, "PTP is capable of sub-microsecond accuracy, which is far better than is normally obtainable with NTP" ([Red Hat](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ptp_using_ptp4l)). Red Hat gives no figure for software timestamping.

Switches matter as much as network cards. Ordinary switches queue packets for varying times. Red Hat warns that non-PTP hardware "will often cause an increase in jitter or introduce an asymmetry in the delay resulting in synchronization inaccuracies", and recommends "that all networking components between PTP clocks are PTP hardware enabled". Basler's advice is the same: "For maximum precision, choose high-quality network hardware, use PTP-enabled network switches, and add an external PTP clock device with a GPS receiver to your network."

The protocol settings must agree across the network. Basler documents three for its cameras:

| Setting | Options | What Basler says |
| :--- | :--- | :--- |
| Delay mechanism | E2E (default) or P2P | "In most cases, use end-to-end delay measurement. Only use peer-to-peer if your entire network is set up for peer-to-peer delay measurement." With P2P, the network mode "can't be set to Hybrid" and the camera "always operates in two-step mode". Older models are fixed at E2E. |
| One-step or two-step | One-step or two-step | On ace 2 and dart M, "two-step operation is disabled by default"; on other models "two-step operation is always enabled". |
| Network mode | Multicast (default), Hybrid, Unicast | Multicast "is the default mode and sufficient for most use cases". Hybrid mixes multicast and unicast; "This saves network load". Unicast needs every device to "support unicast negotiation". |

## Linux recording PCs with linuxptp

On Linux, PTP runs with linuxptp, "a PTPv2 implementation according to the IEEE standard 1588 for Linux" ([Red Hat](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ptp_using_ptp4l)). A Linux PC can be an ordinary clock that follows the network, or the grandmaster that the cameras follow.

| Program | What it does (from the [linuxptp manual index](https://community.nwtime.org/t/linuxptp-documentation/59)) |
| :--- | :--- |
| `ptp4l` | Runs PTP on network ports: "PTP Boundary/Ordinary/Transparent Clock". |
| `phc2sys` | "Synchronize two or more clocks", typically the system clock and the network card's PHC. |
| `ts2phc` | "Synchronizes one or more PTP Hardware Clocks using external time stamps", such as a GPS pulse-per-second edge. |
| `pmc` | "PTP management client", for querying a running `ptp4l`. |
| `phc_ctl` | Directly controls a PHC. |
| `hwstamp_ctl` | Sets "time stamping policy at the driver level". |
| `timemaster` | Runs "NTP with PTP as reference clocks". |

### Step 1: check the network card

Query the interface with `ethtool -T eth3` (replace `eth3` with your interface). Red Hat lists the flags to look for. Hardware timestamping needs `SOF_TIMESTAMPING_RAW_HARDWARE`, `SOF_TIMESTAMPING_TX_HARDWARE` and `SOF_TIMESTAMPING_RX_HARDWARE`; software timestamping needs `SOF_TIMESTAMPING_SOFTWARE`, `SOF_TIMESTAMPING_TX_SOFTWARE` and `SOF_TIMESTAMPING_RX_SOFTWARE`. The output also gives the card's `PTP Hardware Clock` index; index 0 is the device `/dev/ptp0`.

### Step 2: run ptp4l

```bash
# Hardware timestamping (the default), end-to-end delay (the default), log to stdout
ptp4l -i eth3 -m

# A card without hardware timestamping
ptp4l -i eth3 -m -S

# Peer-to-peer delay, only if every switch on the path supports it
ptp4l -i eth3 -m -P
```

From the [ptp4l manual](https://linuxptp.nwtime.org/documentation/ptp4l/): `-i` specifies a port, `-m` prints messages to standard output, `-H` and `-S` select hardware and software timestamping, and `-E` selects end-to-end delay, "This is the default mechanism". `-s` enables client-only mode, which stops the PC from ever becoming master. Red Hat: "Do not run more than one service to set the system clock's time at the same time", so stop chronyd, ntpd or systemd-timesyncd from steering the same clock.

### Step 3: bridge the network card's clock and the system clock

With hardware timestamping, `ptp4l` steers the clock on the network card, not the computer's system clock (`CLOCK_REALTIME`), which is what most recording software uses to stamp frames. Red Hat: "The phc2sys program is needed only with hardware time stamping, for synchronizing the system clock to the PTP hardware clock on the network interface card". The direction depends on the PC's role ([phc2sys manual](https://linuxptp.nwtime.org/documentation/phc2sys/)):

```bash
# PC follows the PTP network: copy the card's clock into the system clock,
# waiting until ptp4l is synchronised
phc2sys -s eth3 -w -m

# PC is the grandmaster for the cameras: copy the system clock into the card
phc2sys -c eth3 -s CLOCK_REALTIME -w -m

# Or let phc2sys follow ptp4l's port state and choose the direction itself
phc2sys -a -r
```

`-s` names the source clock and `-c` the clock to steer (the default is `CLOCK_REALTIME`); `-w` means "Wait until ptp4l is in a synchronized state"; `-a` reads the clocks from the running `ptp4l` and follows changes in port state, and needs `-r` to steer the system clock at all.

### Reading the logs

With `-u` (summary updates) set, `phc2sys` prints summary lines such as Red Hat's example `rms 194 max 457 freq -37084 ± 174 delay 2753 ± 12`. The default prints each sample instead; the [phc2sys(8) man page](https://github.com/richardcochran/linuxptp/blob/227bbd4715bf4cb735be4947e987032f41457585/phc2sys.8#L198-L205): "If zero, the individual samples are printed instead of the statistics." and "The default is 0 (disabled)." Add, for example, `-u 60` to get one summary line per 60 clock updates. In a summary line the first two values are the RMS and maximum offset in nanoseconds over the summary interval, `freq` is the frequency correction in parts per billion, and `delay` is the time taken to read the card's clock. Watch `rms` and `max` during a session; a rising maximum or a change of port state in the `ptp4l` log (for example out of `SLAVE`) marks a take whose timestamps need checking.

## When PTP hardware is missing: NTP with chrony

Many small computers and laptops have no hardware PTP support, and many switches are not PTP-aware. chrony, an NTP implementation, is then the practical choice for keeping recording computers together, and it can do better than NTP's reputation on a local network. The [chrony FAQ](https://chrony-project.org/faq.html) says that with "local hardware timestamping, good network switches, and even shorter polling intervals, a sub-microsecond accuracy and stability of a few tens of nanoseconds might be possible." Without them, accuracy depends on network jitter: in chrony's own [simulated comparison](https://chrony-project.org/comparison.html), a client's clock error was 35 ± 8 µs with 10 µs of network jitter and 1603 ± 447 µs with 10 ms of jitter.

A capture space usually has no internet time it can rely on, so one machine serves time to the rest. The directives below are from the [chrony.conf manual](https://chrony-project.org/doc/4.6/chrony.conf.html):

```text
# On the time server (one recording PC)
local stratum 8          # serve time even with no upstream source
allow 192.168.10.0/24    # let the capture subnet query this server
hwtimestamp *            # use NIC hardware timestamps where supported

# On every other recording PC
server 192.168.10.1 iburst xleave
hwtimestamp *
```

`iburst` makes the first update faster, `xleave` "enables the interleaved mode of NTP", which with hardware timestamps "can significantly improve the accuracy and stability of the measurements", and `hwtimestamp` "enables hardware timestamping of NTP packets sent to and received from the specified network interface". Check the result with `chronyc tracking` and `chronyc sources` ([chronyc manual](https://chrony-project.org/doc/4.6/chronyc.html)).

Clock sync of either kind aligns the computers' clocks. It does not align when a USB camera actually exposed: if frames are stamped on arrival, the USB and operating-system delays described on [why synchronisation matters](https://egocam.ai/sync/why-sync-matters/#latency-and-jitter) remain.

## Enabling and verifying PTP on GigE Vision cameras

Basler's documentation is the most detailed public procedure, and other GenICam cameras follow similar steps under their own parameter names ([Basler](https://docs.baslerweb.com/precision-time-protocol)):

1. **Enable PTP.** "When powering on the camera, PTP is always disabled. If you want to use PTP, you must enable it." Set `GevIEEE1588` to true (or `PtpEnable` on ace 2 and dart M). If an external device is master, "Basler recommends an ANNOUNCE interval of 2 seconds and a SYNC interval of 0.5 seconds."
2. **Wait.** "Depending on your network setup, this may take a few seconds or minutes."
3. **Latch a snapshot.** Execute `GevIEEE1588DataSetLatch` (or `PtpDataSetLatch`), so that "all parameter values in the latched data set refer to exactly the same point in time". Read `GevIEEE1588StatusLatched` rather than `GevIEEE1588Status`, which "is not tied to the GevIEEE1588DataSetLatch command".
4. **Wait until the state is no longer `Initializing`.**
5. **Check lock.** On ace 2 and dart M, "If the parameter value is Locked, the respective device should be sufficiently synchronized." On other cameras, read `GevIEEE1588OffsetFromMaster` from every slave "until the highest offset from master is below a certain threshold (according to your requirements, e.g., 1 millisecond)". Because the servo keeps adjusting, "the offset is not decreasing monotonically. Basler recommends that you check the maximum GevIEEE1588OffsetFromMaster parameter value within a given time window". Set the threshold from your own error budget.

| Parameter | What it reports or controls |
| :--- | :--- |
| `GevIEEE1588` / `PtpEnable` | Turns PTP on; off at every power-up. |
| `BslPtpPriority1` | Priority 1 on ace 2 and dart M, 0 to 255; lowest wins. |
| `GevIEEE1588DataSetLatch` / `PtpDataSetLatch` | Takes a consistent snapshot of the PTP state. |
| `GevIEEE1588StatusLatched` | Port state: Initializing, Faulty, Disabled, Listening, Pre_Master, Master, Passive, Uncalibrated or Slave. |
| `PtpServoStatus` | `Locked` when synchronised, otherwise `Unknown` (ace 2 and dart M). |
| `GevIEEE1588OffsetFromMaster` | "estimated temporal offset between the master clock and the clock of the current PTP device in ticks (1 tick = 1 nanosecond)". |
| `GevIEEE1588ParentClockId` / `PtpGrandmasterClockID` | ID of the current master or grandmaster. Every camera should report the same one. |

## From a shared clock to simultaneous exposure

A common PTP clock gives synchronised timestamps, not synchronised exposures (see [two meanings of in sync](https://egocam.ai/sync/why-sync-matters/#two-meanings-of-in-sync)). Two free-running 30 fps cameras whose clocks agree perfectly can still expose at unrelated phases, so their nearest frames can be up to half a frame period apart: 33.3 / 2 = 16.7 ms.

GigE Vision added a fix. Earlier action commands were sent to all cameras at once, but "there were still some inconclusive elements, such as delays in network propagation and delays in firmware processing". GigE Vision 2.0 combined them with IEEE 1588 so that each camera is told a time at which to act, rather than acting when the packet arrives ([Eikawa, 2017](https://www.vision-systems.com/articles/print/volume-22/issue-4/features/integration-insights-ieee1588-simplifies-camera-synchronization.html)). Basler lists the features PTP enables on its cameras as "Periodic Signal", "Scheduled Action Commands" and "Synchronous Free Run".

The published figures are vendor statements:

- **Sony.** For free-running cameras whose exposure start is aligned to the grandmaster: "Although this is affected by the network environment, it is ideally possible for exposure synchronous control to be performed within 1μs", with the figure caption "it is possible to drive exposure synchronization to within ±1μs" ([Eikawa, 2017](https://www.vision-systems.com/articles/print/volume-22/issue-4/features/integration-insights-ieee1588-simplifies-camera-synchronization.html)).
- **SVS-Vistek.** "The maximum deviation that can be achieved is 10 µs, which enables very precise synchronization of all devices involved" ([SVS-Vistek](https://web.archive.org/web/2026/https://www.svs-vistek.com/en/knowledgebase/svs-about-machine-vision.php?p=ptp-766)).

With Power over Ethernet, Sony notes, "only one cable is required for exposure synchronization, image output and the power supply."

### Limits

- **No instant trigger.** SVS-Vistek: "It is necessary to know the future time of triggering (ad-hoc event-based triggering is not possible)", and "A common immediate trigger ("NOW I want to trigger all cameras") is not supported by PTP." Event-driven capture still needs a wire.
- **Devices that do not speak PTP.** In 2017 Sony described linking cameras' general-purpose outputs to PTP time as a plan ("Sony is planning to link the new camera series to GPO"), not a shipped feature, so check what your camera's outputs can do. In the other direction, a GPS receiver's or microcontroller's pulse-per-second signal can discipline a Linux grandmaster's network card with `ts2phc`; the [hardware sync page](https://egocam.ai/sync/hardware-sync/#gps-and-pulse-per-second-pps) covers PPS.

## Prompts you can give an AI

These prompts ask for code you can check yourself; read the output before trusting it.

### Wait for GigE cameras to lock before recording

```text
Write a Python script using pypylon that opens every Basler GigE camera found,
enables PTP (PtpEnable on ace 2 / dart M, GevIEEE1588 on other models), then
blocks until all cameras are synchronised, following Basler's documented check:
execute the DataSetLatch command, read GevIEEE1588StatusLatched and wait until
it is no longer Initializing; on cameras with PtpServoStatus wait for Locked;
otherwise sample GevIEEE1588OffsetFromMaster (1 tick = 1 ns) once per second and
pass only when the maximum absolute offset over a rolling window stays below a
threshold. Take the threshold, the window length and the overall timeout as
required command-line arguments with no defaults. Check that all cameras report
the same GevIEEE1588ParentClockId, print a status table while waiting, and exit
with an error on timeout.
```

### Flag takes with bad clock sync

```text
Write a Python script that parses logs from `ptp4l -m` and `phc2sys -m` recorded
during a capture session, plus a CSV of take start and end times. Extract the
offset (ns), frequency (ppb) and delay over time, and every port state change.
For each take, report the RMS and maximum absolute offset and any state change,
and flag takes whose maximum offset exceeds a threshold given on the command
line. Save one plot per take.
```

## Sources

- Ali et al. (2026). [RoboCap](https://arxiv.org/abs/2610.07217). arXiv.
- Lee et al. (2026). [Ego-1K: A large-scale multiview video dataset for egocentric vision](https://arxiv.org/abs/2603.13741). *CVPR*.
- Basler. [Precision Time Protocol](https://docs.baslerweb.com/precision-time-protocol).
- e-con Systems (2023). [The role of Precision Time Protocol synchronisation in Ethernet cameras](https://mvpromedia.com/e-con-systems-the-role-of-precision-time-protocol-synchronisation-in-ethernet-cameras/). MVPro Media.
- linuxptp. [ptp4l(8) manual](https://linuxptp.nwtime.org/documentation/ptp4l/), [phc2sys(8) manual](https://linuxptp.nwtime.org/documentation/phc2sys/) and [documentation index](https://community.nwtime.org/t/linuxptp-documentation/59). Network Time Foundation.
- Red Hat. [RHEL 7 System Administrator's Guide: Configuring PTP using ptp4l](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ptp_using_ptp4l).
- Eikawa, S. (2017). [Integration insights: IEEE1588 simplifies camera synchronization](https://www.vision-systems.com/articles/print/volume-22/issue-4/features/integration-insights-ieee1588-simplifies-camera-synchronization.html). Vision Systems Design.
- SVS-Vistek. [Knowledge base: Precision Time Protocol](https://web.archive.org/web/2026/https://www.svs-vistek.com/en/knowledgebase/svs-about-machine-vision.php?p=ptp-766) (archived copy; the live page now redirects to Allied Vision).
- chrony. [Frequently asked questions](https://chrony-project.org/faq.html), [comparison of NTP implementations](https://chrony-project.org/comparison.html), [chrony.conf manual](https://chrony-project.org/doc/4.6/chrony.conf.html) and [chronyc manual](https://chrony-project.org/doc/4.6/chronyc.html).
