Re: [Linuxptp-users] Measure the accuracy of system time respect to the PHC time
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Ledda W. E. <Wil...@it...> - 2013-08-22 13:44:31
|
Thanks Richard. Now I have a better understanding of the problem and I can support the use of this approach. Regards -----Original Message----- From: Richard Cochran [mailto:ric...@gm...] Sent: 22 August 2013 14:39 To: Ledda William EXT Cc: lin...@li... Subject: Re: [Linuxptp-users] Measure the accuracy of system time respect to the PHC time On Thu, Aug 22, 2013 at 12:16:32PM +0000, Ledda William EXT wrote: > Hi all, > I need to measure the accuracy of the system time respect to the time > from the PHC. With the two clock synchronize with phc2sys I've tried > the following > > clock_gettime(CLOCK_REALTIME, &ts) (here is a delay of a few microseconds, reading the PCIe bus) > clock_gettime(phc, &tphc) > accuracy = ts - tphc > > In this way the accuracy is always about 3 us. > > I'm a bit confused about the difference between this value and the offset reported from phc2sys (always under 1us). I have seen the code in order to find the reason of this difference and I understand that the offset is calculated reading the PHC between two system time and assuming that the PHC is exacltly in the half between them. > > My question is: which is the best way to measure the accuracy between the system time and the PTP time? The best way would be to feed signals from both clocks into a oscilloscope or frequency counter. However, the Linux system time is a software clock, so you cannot do that. The next best way that I know of is to do what phc2sys does. There is an ioctl called PTP_SYS_OFFSET to read the two clocks in kernel space (which phc2sys uses if available). Your suggestion is poor because you are comparing the two clocks at different points in time. HTH, Richard |