From owner-freebsd-hackers@FreeBSD.ORG Mon Apr 27 15:22:42 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C76A59ED for ; Mon, 27 Apr 2015 15:22:42 +0000 (UTC) Received: from mail-ig0-x233.google.com (mail-ig0-x233.google.com [IPv6:2607:f8b0:4001:c05::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 914B812FE for ; Mon, 27 Apr 2015 15:22:42 +0000 (UTC) Received: by igblo3 with SMTP id lo3so63949493igb.0 for ; Mon, 27 Apr 2015 08:22:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ALbDk0TIha4KIu/IGdIfAZv92DXWH8OrrRG/uEhK4V4=; b=vcYfggI2L5iiJ/i4ppPwDTxEYXcgm7QU6RJ/tPkDtYJMLsPzFrowFPFn7opeVNvY+h h0pzrLUVPTfVV6M7lcUo20GP8lzs2xVywYDzVN08GqKMEoZ+GKo7cO6lyalQKkwj2N+p 7trHHUaNBOY49w904BPSqTfjRIAOOCxY7Y/pQhkmxkNqLoikf0sP/1ubCZMD27yriDyx a6ZNUWLttirCXl2QbBC+U0Xj0JvWwg738aomg4zAMnJOXu1xlV7mk+Q4pXOtqQW7pSbw dehyEYJv7+2AMGYTamF/OLkgWivmkCJW/JftPHniv0Mk+A/Bzmh5MzaCpzVh0uf7Tn2p FA0g== MIME-Version: 1.0 X-Received: by 10.50.109.138 with SMTP id hs10mr14128369igb.48.1430148162057; Mon, 27 Apr 2015 08:22:42 -0700 (PDT) Received: by 10.64.1.110 with HTTP; Mon, 27 Apr 2015 08:22:41 -0700 (PDT) In-Reply-To: References: Date: Mon, 27 Apr 2015 08:22:41 -0700 Message-ID: Subject: Re: System clock always unsynced From: Freddie Cash To: Christian Weisgerber Cc: FreeBSD Hackers Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2015 15:22:42 -0000 On Mon, Apr 27, 2015 at 7:39 AM, Christian Weisgerber wrote: > I run OpenNTPD, from ports/net/openntpd, and I've noticed that after > each reboot, the initial system time is further off. (This is quite > noticeable with OpenNTPD, since by default it does *not* jump the > clock on startup like the base ntpd does.) It's as if the RTC was > never synchronized to the system clock. > > Some digging in sys/kern/kern_ntptime.c shows indeed that the RTC is > only synced if STA_UNSYNC is not set, and dumping the value of the > timex struct... > > offset: 0 > freq: 2730304 > maxerror: 84860000 > esterror: 500000 > status: UNSYNC > constant: 0 > precision: 0 > tolerance: 32500000 > state: ERROR > > ... reveals that the clock remains permanently unsynced. Clearly, > OpenNTPD, which uses adjtime(2) to correct offsets and ntp_adjtime(2) > with MOD_FREQUENCY to correct the frequency, doesn't handle this > quite right. > > What *does* an ntpd daemon need to do to sync the clock? > > The ntp_adjtime(2) man page documents struct timex in detail, but > is very vague on what all of this means. > > =E2=80=8BIsn't this why there's a "-s" option for openntpd, which syncs t= he clocks when the daemon starts? And an "openntpd_flags" option in rc.conf =E2=80= =8B =E2=80=8Bfor enabling that option?=E2=80=8B --=20 Freddie Cash fjwcash@gmail.com