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.
Find out PTP device associated with the IUT interface, call open() to get its FD.
Call ioctl (
PTP_SYS_OFFSET_EXTENDED
) on the PTP device FD asking for n_samples samples.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.
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 |