Date: Tue, 28 Apr 2015 13:57:41 +0200 From: Christian Weisgerber <naddy@mips.inka.de> To: Ian Lepore <ian@freebsd.org> Cc: freebsd-hackers@freebsd.org Subject: Re: System clock always unsynced Message-ID: <20150428115741.GA68174@lorvorc.mips.inka.de> In-Reply-To: <1430177037.1157.23.camel@freebsd.org> References: <slrnmjsigv.8j.naddy@lorvorc.mips.inka.de> <slrnmjsp0a.17je.naddy@lorvorc.mips.inka.de> <1430177037.1157.23.camel@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Ian Lepore: > > Okay, let me rephrase this since the first two replies completely > > missed the point. This is an API programming question. How is the > > poorly documented ntp_adjtime() API to be used so the system clock > > will lose the STA_UNSYNC status and switch from TIME_ERROR to TIME_OK > > as clock state? > > It requires a call to ntp_adjtime() with the MOD_STATUS bit set in > ntv.modes and the STA_UNSYNC bit clear in ntv.status. Well, yes. You omitted the crucial piece of information, but I think I have figured it out from reading kern_ntptime.c: The STA_UNSYNC value is _read_ by the kernel and (mostly) _set_ by userland. It is ntpd that is supposed to clear STA_UNSYNC to signal the kernel that the time is synchronized. The ntp_adjtime(2) man page doesn't say anything how STA_UNSYNC is used and I had naturally assumed that it was the kernel that cleared STA_UNSYNC to let ntpd know (that the offsets had been applied or whatever). -- Christian "naddy" Weisgerber naddy@mips.inka.de
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150428115741.GA68174>