How to adjust clock frequency in FreeBSD 10.1 ?

Rick Thomas rbthomas at cs.rutgers.edu
Sat Mar 14 02:48:27 UTC 2015



> On 02/12/15 04:09, Rick Thomas wrote:
>> I’ve got a machine with a really bad clock.  When I run NTPD on it,
>> the freq goes straight to 500.0 (over a period of a few days) and
>> stays there, while the offset grows and grows.
>> 
>> I recently switched this machine from Debian Linux to FreeBSD
>> (wanting to learn more about FreeBSD).  Under Linux, I used
>> adjtimex to modify the TICK value and (once I had converged on the
>> right TICK value) NTP was able to stabilize the clock.
>> 
>> Is there an equivalent hack for FreeBSD?

On Feb 25, 2015, at 4:41 AM, lokadamus at gmx.de wrote:
> You can use a cronjob with ntpdate to synchronize your clock.
> But ntpd shouldn’t run, when ntpdate is used.
> 

As it turns out, current versions of ntpd will do as well as (actually better than) periodic ntpdate — even under such adverse circumstances as this machine.  What it does is to attempt to slew the time using its normal algorithms until the frequency adjustment gets pegged at 500ppm and the offset is over 1 second. Then it steps the clock and starts the game all over.  This is better than previous versions of ntpd and xntpd.  They would get to that point and abort — on the theory that something was acutely wrong and needed human operator attention.  Current versions at least have the option of plugging on as best as possible.

So, with current ntpd, the system clock is never more than about 1 second off from network time.

And for a normal desktop machine (or ever a small-/home-office server) that’s really good enough and I should stop complaining.  BUT…

The trouble is, I’m a “time nut” and I keep this machine (and a few others) around specifically as a test case — to prove that it *is* possible to keep good time (sub millisecond offsets from a GPS server on the same LAN) even with machines that are out of spec, as long as they are *reliably* out of spec.

I’ve succeeded in twisting Linux to my ends as noted in my original post (quoted above), but so far I haven’t found a way to do that for FreeBSD, short of custom modifications to the kernel and/or ntpd.

Any and all suggestions will be gratefully received.

Enjoy!
Rick

PS: Does anybody know if there’s a FreeBSD package for P-HK’s Ntimed?




More information about the freebsd-questions mailing list