[ntp:questions] how to write a reference clock driver

Harlan Stenn stenn at ntp.org
Tue Dec 16 23:39:16 UTC 2008


>>> In article <4944eab4$0$12693$9b622d9e at news.freenet.de>, Juergen Kosel <juergen.kosel at freenet.de> writes:

Juergen> Hello, Greg Dowd schrieb:
>> I'm not quite sure what you mean.  A reference clock doesn't compute an
>> offset, it acquires, formats and returns a time value from an external
>> source.  NTP takes care of the rest.

Juergen> ntpd reads the time of a reference clock with a reference clock
Juergen> driver.  My problem was, that I didn't know from the manual what
Juergen> need to be done with the time from the reference clock. Especially
Juergen> when it is in a differnet format than of the other reference
Juergen> clocks.

Juergen> But finally I succeeded by calculating the difference between
Juergen> refence clock time - system clock time and using the SAMPLE() macro
Juergen> to insert this value into the the right data structure entry of
Juergen> ntpd.


Juergen,

Most refclock drives do not do it the way you describe.

They take the time from the reflock along with the system timestamp (with
the intent to get the system timestamp as close as possible to the moment
the refclock timestamp is obtained), build the contents of the struct
refclockproc, and call refclock_process().

-- 
Harlan Stenn <stenn at ntp.org>
http://ntpforum.isc.org  - be a member!




More information about the questions mailing list