Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Aug 2010 02:17:08 +0000
From:      "b. f." <bf1783@googlemail.com>
To:        freebsd-hackers@FreeBSD.org
Cc:        phil hefferan <wdef200@gmail.com>, Phil Grundig <wdef200@yahoo.co.uk>
Subject:   Re: How to read cmos clock - what is gettimeofday reading?
Message-ID:  <AANLkTimNLAdPYQ0-yqyvR4YEuUsEG%2Bmc7rFQ%2BWZUAvYh@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
>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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTimNLAdPYQ0-yqyvR4YEuUsEG%2Bmc7rFQ%2BWZUAvYh>