Check PTP_SYS_OFFSET_EXTENDED ioctlΒΆ

Check that PTP_SYS_OFFSET_EXTENDED ioctl can be used to obtain samples of PTP device time and system time at the same moment.

  1. Find out PTP device associated with the IUT interface, call open() to get its FD.

  2. Call ioctl (PTP_SYS_OFFSET_EXTENDED) on the PTP device FD asking for n_samples samples.

  3. Compute average difference between timestamps from PTP and system clocks over the array of retrieved samples. Check that difference in every sample is close to that average.

  4. Estimate offset between PTP and system clocks with help of two consecutive clock_gettime() calls. Check that this estimate is close to the average difference between clocks obtained with PTP_SYS_OFFSET_EXTENDED.

Parameters:

env

Testing environment:

n_samples

How many samples to request from PTP_SYS_OFFSET_EXTENDED