[ntp:questions] Using ntpd with custom clock
cswiger at mac.com
Tue Oct 16 22:04:25 UTC 2012
On Oct 16, 2012, at 2:49 PM, Felipe Blauth wrote:
> 2012/10/16 Brian Utterback <brian.utterback at oracle.com>
>> I think the original poster is asking to do something a little bit different than the usual. If I am reading it right, he is not asking how to get ntpd to read a custom clock as a source of time (which as noted is what a refclock is for). I think he is asking how to get ntpd to *set* a custom clock, treating it as it would the system clock, so as to sync the custom clock with the upstream NTP server time.
> That's exactly what I want to do.
OK. You can either hook into ntpd's calls to get/settimeofday() and adjtime() as you initially suggested, or perhaps look into the SHM driver. The latter is a generic interface that puts clock timestamps into shared memory; but you can read from SHM instead of writing, if you like-- would be easier if you have something like a GPS receiver and gpsd populating the SHM timestamps.
Or, at a different level of abstraction, can you manage your custom clock as an (S)NTP client, and not need to change ntpd itself at all?
More information about the questions