Re: [Linuxptp-users] PTP master slewing to other network time
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Dave C. <dav...@un...> - 2013-08-21 12:42:38
|
On Wed, Aug 21, 2013 at 1:03 PM, Miroslav Lichvar <mli...@re...>wrote: > On Wed, Aug 21, 2013 at 12:46:01PM +0100, Dave Craig wrote: > > On Wed, Aug 21, 2013 at 12:29 PM, Miroslav Lichvar <mli...@re... > >wrote: > > > You can check if the local PTP port is in the master state with > > > pmc -u -b 0 'GET PORT_DATA_SET'. > > > > Although I can get the master state and then choose to set the system > clock > > based on that, it means that I'd be writing very similar code to the > servo > > code of PTP inside my NTP process. It currently just calls settimeofday, > > but I'd rather it slewed to the new time more gracefully. I wondered if > > having that work done inside ptp4l would be tidier? In the master state > the > > clock servo would be accepting changes over pmc and in the slave state > > ignoring it. > > You could use the adjtime system call instead of settimeofday to > adjust the clock slowly and not in one step. > That's probably the approach I'll take. I was concerned about a race between calling pmc to find out if the local device was the master and actually setting the time, but it's by far the simplest solution and the chances of a race are small and it's effects fairly minor. > I guess there could be a private pmc command to feed the servo > manually, but it would have to be called periodically in the sync > interval as the servo can't slew the clock by a specified offset with > just one point. It's a feedback loop. > The NTP process gets the time fairly regularly so this wouldn't be a problem. > Why not use ntpdate or a regular NTP daemon instead? > Unfortunate legacy reasons :-( Thanks again for your advice, Dave |