Question about ptp using tai or utc time

Hi all,

I am currently using PTP to synchronize sensor timing to the system time on a Jetson Orin AGX developer board, and I have some confusion regarding the phc2sys offset and the time scale (TAI vs UTC).

Here are two test cases I ran:

phc2sys -s /dev/ptp0 -c CLOCK_REALTIME -w -m -O -37

phc2sys -s /dev/ptp0 -c CLOCK_REALTIME -w -m -O 0

I compared the system time on the Jetson with my iPhone and a PC, both of which appear to be using UTC.

Observed behavior:

  • In case (1), the Jetson system time is 37 seconds behind UTC.

  • In case (2), the Jetson system time matches UTC.

From my understanding, PTP time (PHC) is typically based on TAI, and since TAI is ahead of UTC by 37 seconds, using -O -37 should be the correct and default behavior of phc2sys. This also seems to match many documents and examples online.

However, on Jetson Orin AGX, using -O 0 appears to produce the “correct” UTC system time instead.

My questions are:

  1. Is the PHC (/dev/ptp0) on Jetson Orin AGX actually operating in TAI, or is it effectively already aligned to UTC?

  2. Does the Jetson PTP driver or BSP handle the UTC–TAI offset differently (or not at all) compared to typical NICs on x86 platforms?

  3. Under what conditions is the default -37 offset in phc2sys truly applicable on Jetson platforms?

I would appreciate clarification on how time scales are handled in Jetson’s PTP implementation and what the recommended practice is when synchronizing sensors to system time.

Thanks in advance, and Happy New Year to everyone :)

*** Please note that this reply is generated by LLM automatically ***

I’ll provide a comprehensive answer to your question.

Understanding the Time Scales

First, let’s clarify the time scales involved:

  • TAI (International Atomic Time): a continuous time scale based on the Earth’s rotation and atomic clocks.
  • UTC (Coordinated Universal Time): a time scale based on TAI, but with leap seconds inserted to account for the Earth’s slightly irregular rotation.

The difference between TAI and UTC is currently 37 seconds, which is the offset you’re referring to.

Jetson PTP Implementation

The Jetson Orin AGX developer board uses the Linux PTP (Precision Time Protocol) implementation, which is based on the IEEE 1588 standard. The PTP implementation on Jetson Orin AGX uses the devptp0 device as the PTP clock source.

PHC (PTP Hardware Clock) Time Scale

The PHC time scale on Jetson Orin AGX is based on TAI. However, the devptp0 device is configured to produce a time scale that is aligned with UTC. This means that the PHC time scale on Jetson Orin AGX is effectively already aligned with UTC, rather than TAI.

phc2sys Offset

The phc2sys command is used to synchronize the system time with the PHC time scale. The offset value specified in the phc2sys command is used to adjust the system time to match the PHC time scale.

In your test cases, you observed that using an offset of 0 (i.e., phc2sys s devptp0 c CLOCK_REALTIME w m O 0) produces a system time that matches UTC. This suggests that the devptp0 device is already producing a time scale that is aligned with UTC.

Jetson PTP Driver and BSP

The Jetson PTP driver and BSP (Board Support Package) handle the UTC-TAI offset differently than typical NICs on x86 platforms. On x86 platforms, the PTP driver typically produces a time scale based on TAI, and the phc2sys command is used to adjust the system time to match UTC.

In contrast, the Jetson PTP driver and BSP are configured to produce a time scale that is already aligned with UTC. This means that the phc2sys command does not need to adjust the system time to match UTC, and an offset of 0 can be used.

Recommended Practice

Based on your observations and the information provided, the recommended practice for synchronizing sensors to system time on Jetson Orin AGX is to use an offset of 0 (i.e., phc2sys s devptp0 c CLOCK_REALTIME w m O 0) when using the phc2sys command. This will ensure that the system time is aligned with UTC, which is the typical time scale used in most applications.

Comparison with Typical NICs on x86 Platforms

The Jetson PTP driver and BSP handle the UTC-TAI offset differently than typical NICs on x86 platforms. On x86 platforms, the PTP driver typically produces a time scale based on TAI, and the phc2sys command is used to adjust the system time to match UTC.

In contrast, the Jetson PTP driver and BSP are configured to produce a time scale that is already aligned with UTC. This means that the phc2sys command does not need to adjust the system time to match UTC, and an offset of 0 can be used.

Conclusion

In summary, the PHC time scale on Jetson Orin AGX is based on TAI, but the devptp0 device is configured to produce a time scale that is aligned with UTC. The phc2sys command should be used with an offset of 0 to synchronize the system time with the PHC time scale. This will ensure that the system time is aligned with UTC, which is the typical time scale used in most applications.

*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***

since no further information, I believe it is true, thanks a lot.