[ntp:questions] NTP & PPS, part 2 ;)

Martin Burnicki martin.burnicki at meinberg.de
Thu Dec 18 08:42:40 UTC 2014

Harlan Stenn wrote:
> Rob writes:
>> Harlan Stenn <stenn at ntp.org> wrote:
>>> Rob writes:
>>>> Harlan Stenn <stenn at ntp.org> wrote:
>>>>> Paul writes:
>>>>>> On Tue, Dec 16, 2014 at 10:10 AM, Martin Burnicki <
>>>>>> martin.burnicki at meinberg.de> wrote:
>>>>>>> OK, but what is the problem in using these IOCTLs directly from withi
>> n
>>>>>>> ntpd, via wrapper functions or directly? Several refclock drivers do
>> so.
>>>>>> You'll have to ask Harlan.
>>>>> Useful discussion and patches would be nice.
>>>> The code does not have to be patched because it already works, you only
>>>> need to move the timepps.h file into the distributed source.  It provides
>>>> the wrapper functions between the existing refclocks and the IOCTLs.
>>> Since you don't see my POV and I've looked at yours several times and
>>> always see how doing what you suggest will cause horrible headaches and
>>> problem, something else will have to shift.
>> When you really think that doing the above will cause headaches, then
>> the direct use of IOCTLs will do even more so.  With my solution you
>> can at least update the timepps.h file in the case there would be a
>> change in the IOCTLs, when you access those directly you will have to
>> solve the problem yourself.
> Please post a copy of this timepps.h file that will work for all
> versions of all OSes that are running NTP.

I can fully understand Rob's reasoning.

Without having looked at the code base, I'm sure there are already 
predefined macros available for the current build target/architecture.

So it should not be a problem to include something like

#if defined( SOLARIS )
  #include <timepps_solaris.h>
#elif defined ( SCO )
  #include <timepps_sco.h>
#elif defined ( LINUX ) || defined( FREEBSD )
  #include <timepps.h>

If this piece of code is required more than once it should be put into a 
common header file which is included in all places where this is 
required. No duplicate code.


More information about the questions mailing list