From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 20 02:17:10 2010 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6690310656A5 for ; Fri, 20 Aug 2010 02:17:10 +0000 (UTC) (envelope-from bf1783@googlemail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id F24E18FC13 for ; Fri, 20 Aug 2010 02:17:09 +0000 (UTC) Received: by wyj26 with SMTP id 26so3461362wyj.13 for ; Thu, 19 Aug 2010 19:17:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:received:reply-to:date :message-id:subject:from:to:cc:content-type; bh=jSznsicUKsbq+ys9BLZ19TN0TvjXVf0oGHBeC5KX/iI=; b=H34xkaHJUF49EPFtU9otAdm98CMna1joObvTVRr/rQ2Awe6E450tqHemSxYcllwU3S yiApxRpvXKT0CcmE4qgfpqG9LU+RIswsSapcJcQVJL8NaTnxQ32KNJ01o/2N2i3uAd73 oKExFv972f2DyAtrlGa40Hw++Lxx5vOCJcfyg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:reply-to:date:message-id:subject:from:to:cc :content-type; b=Di0G2qyoAH7tYDY3aj+7KzAQovqPIDIeBoIai1+EufEAtpRr0wYFqTVr/uwRLiS/eE iZoe6xFklyIuew38DeihYdqMKxgjrf8SnukFQaykBwTTTp+Ks681BtNl8EpA7bUDQoN2 mRlxXLopzw+wB3VGBJNhgrj8IEksPa7MPPh8g= MIME-Version: 1.0 Received: by 10.216.188.209 with SMTP id a59mr1327529wen.87.1282270628453; Thu, 19 Aug 2010 19:17:08 -0700 (PDT) Received: by 10.216.183.212 with HTTP; Thu, 19 Aug 2010 19:17:08 -0700 (PDT) Date: Fri, 20 Aug 2010 02:17:08 +0000 Message-ID: From: "b. f." To: freebsd-hackers@FreeBSD.org Content-Type: text/plain; charset=ISO-8859-1 Cc: phil hefferan , Phil Grundig Subject: Re: How to read cmos clock - what is gettimeofday reading? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: bf1783@gmail.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2010 02:17:10 -0000 >To further confuse matters there appears to be a common misconception on the web >that the cmos time is automatically synced to system time on FreeBSD. This is >incorrect: see msg03414 on freebsd-hardware at freebsd.org. The situation has changed in 8-STABLE and 9-CURRENT since the above message was written. The timekeeping code was changed (by the person who wrote the message that you cited) to periodically (every machdep.rtc_save_period seconds) adjust the value of the rtc if ntp is used to update the system time, machdep.disable_rtc_set=0, and the rtc driver hasn't been disabled: http://svnweb.freebsd.org/viewvc/base?view=revision&revision=207360 http://svnweb.freebsd.org/viewvc/base?view=revision&revision=208297 atrtc_{get,set}time, now in /usr/src/sys/x86/isa/atrtc.c, could serve as a basis for your own code: http://svn.freebsd.org/viewvc/base/head/sys/x86/isa/atrtc.c?view=markup There are of course *_rtc_{get,set}time variants for other architectures as well. b.