Timestamp correction

The TwinCAT time, which is used by default for timestamps in the TwinCAT Analytics Logger, may deviate from the actual system time after a longer period of use of the controller. This is due to the fact that different hardware counters are used as clock generators. With the concept of timestamp correction, it is possible to add an external offset to the TwinCAT timestamp, which corrects the timestamp. The correction using the External Time Provider can be made both in relation to an external time source via NTP (Network Time Protocol) and in relation to the EtherCAT Distributed Clock via PTP (Precision Time Protocol).

You can specify the time provider type individually for each defined target. The default value is always your own system time.

Timestamp correction 1:

You can use the drop-down box to select a time provider in the desired accuracy class. For example, External Time Soft. If no time provider has yet been created in the TwinCAT project in the accuracy class, the Analytics Logger will output No time provider found at this point. You can then click on this area and a window will ask you whether you want to choose NTP or PTP (EtherCAT DC). A corresponding object is then created automatically.

Timestamp correction 2:

Under the system node in the TwinCAT project tree, you will also immediately see a new object under TcCOM Objects. You can open this from there or double-click on the object name in the Analytics Logger tab and the same page will be opened automatically.

Timestamp correction 3:

Here you should ensure that the Task that controls the Time Provider object is selected in the Context tab.

Timestamp correction 4:

In addition, the cycle time of the provider's synchronization with the NTP server and the server host name can be set via the Init parameter. The Analytics Logger uses this to create timestamp corrections to compensate for the difference between the TwinCAT system time and the NTP-synchronized time.