System Time Drift on TSN-Enabled Real-Time Controllers When Time Is Manually Set

Updated Dec 13, 2023

Reported In

Hardware

  • CompactRIO Controller

Operating System

  • NI Linux Real-Time

Issue Details

I have developed and deployed an application to a Real-Time TSN-Enabled target. Over time, while the target is executing, I see that the system time drifts with respect to external time sources (clocks, cell phones, etc.). 

Solution

On TSN enabled targets with timing and synchronization services installed, setting the system time can cause a discrepancy between the system time and the hardware clock. The Timing & Synchronization Services will detect this discrepancy and correct for it, causing the observed drift. Restarting the target will set all the clocks to the system time. This will significantly reduce drift in the short term but will not prevent future drift. To prevent the time drift from occurring in the long-term, avoid installing packages and software which include the Timing & Synchronization Services.

On Linux targets which do not have the Timing & Synchronization Services installed, an NTP Daemon can be implemented to synchronize the system time to an external NTP Server.

 

Additional Information

Software packages which install Timing and Synchronization Services are:
  • NI-DAQmx
  • 802.1AS Time Reference
  • 1588 Time Reference
  • NI Industrial Communications for EtherCAT
The Set Time.vi is not intended for synchronization of multiple real-time devices. Refer to the Choosing a CompactRIO Synchronization Technology white paper for information on the synchronization of multiple real-time devices.