Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Updating and displaying CMOS clock

607 views
Skip to first unread message

Victor Sudakov

unread,
Jul 6, 2014, 11:32:07 AM7/6/14
to
Colleagues,

What's the command to update the CMOS clock to the time of the kernel
clock?

ntpd does a good job of keeping the accurate time in the kernel clock,
but from my experience, this time is not propagated to the CMOS clock
which lives its own life. As a result, there is a large time skew
everytime the box is rebooted, which prevents from Kerberos login
until the kernel clock is synchronized.

In other words, what's the FreeBSD equivalent of the Linux
"hwclock --systohc" command?

And no, contrary to popular belief, the correction of the CMOS clock
does not happen automatically in FreeBSD even if ntpd is running.

If there is a way to display the time of the CMOS (RTC) clock, I
would be interested to know too.

TIA.

--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
sip:sud...@sibptus.tomsk.ru
_______________________________________________
freebsd-...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questi...@freebsd.org"

Warren Block

unread,
Jul 6, 2014, 5:03:55 PM7/6/14
to
On Sun, 6 Jul 2014, Victor Sudakov wrote:

> In other words, what's the FreeBSD equivalent of the Linux
> "hwclock --systohc" command?

Offhand, I don't know. But date(1) sets both kernel and hardware
clocks, so a hacky way to do that is

date -v +0S

> And no, contrary to popular belief, the correction of the CMOS clock
> does not happen automatically in FreeBSD even if ntpd is running.

I'm a little surprised about that, too, although the relatively large
adjustment in time after a reboot is an indicator. Now that you mention
it, anyway.

Jesse Gooch

unread,
Jul 6, 2014, 5:14:51 PM7/6/14
to
Hi Victor,

On 06/07/14 08:32 AM, Victor Sudakov wrote:
> Colleagues,
>
> What's the command to update the CMOS clock to the time of the kernel
> clock?
>
> ntpd does a good job of keeping the accurate time in the kernel clock,
> but from my experience, this time is not propagated to the CMOS clock
> which lives its own life. As a result, there is a large time skew
> everytime the box is rebooted, which prevents from Kerberos login
> until the kernel clock is synchronized.
>
> In other words, what's the FreeBSD equivalent of the Linux
> "hwclock --systohc" command?
>
> And no, contrary to popular belief, the correction of the CMOS clock
> does not happen automatically in FreeBSD even if ntpd is running.
>
> If there is a way to display the time of the CMOS (RTC) clock, I
> would be interested to know too.
>
> TIA.
>

To get around this I've started using ntpdate on boot. You can put the
following in your /etc/rc.conf:

---
ntpdate_enable="YES"
ntpdate_flags="<time server here>"
---

Victor Sudakov

unread,
Jul 6, 2014, 10:10:15 PM7/6/14
to
Warren Block wrote:
>
> > In other words, what's the FreeBSD equivalent of the Linux
> > "hwclock --systohc" command?
>
> Offhand, I don't know. But date(1) sets both kernel and hardware
> clocks, so a hacky way to do that is
>
> date -v +0S

I have googled up another hacky way of to do that:

sysctl `sysctl -e machdep.adjkerntz`

It's from https://www.mail-archive.com/freebsd-...@freebsd.org/msg03414.html

But I have not found anything to display the CMOS clock, only to set it.

--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
sip:sud...@sibptus.tomsk.ru

Victor Sudakov

unread,
Jul 6, 2014, 10:10:22 PM7/6/14
to
Jesse Gooch wrote:
> >
> > What's the command to update the CMOS clock to the time of the kernel
> > clock?

[dd]

> >
>
> To get around this I've started using ntpdate on boot. You can put the
> following in your /etc/rc.conf:
>
> ntpdate_enable="YES"

ntpd_sync_on_start="YES" does the same, but it is not an answer to the
question, it is a workaround.

Victor Sudakov

unread,
Jul 6, 2014, 10:12:39 PM7/6/14
to
Warren Block wrote:
>
> > In other words, what's the FreeBSD equivalent of the Linux
> > "hwclock --systohc" command?
>
> Offhand, I don't know. But date(1) sets both kernel and hardware
> clocks, so a hacky way to do that is
>
> date -v +0S

BTW this command does not set anything, it only displays the time with
the specified offset.

Jesse Gooch

unread,
Jul 6, 2014, 10:23:15 PM7/6/14
to
Hi Victor,

On 06/07/14 07:10 PM, Victor Sudakov wrote:
> Jesse Gooch wrote:
>>>
>>> What's the command to update the CMOS clock to the time of the kernel
>>> clock?
>
> [dd]
>
>>>
>>
>> To get around this I've started using ntpdate on boot. You can put the
>> following in your /etc/rc.conf:
>>
>> ntpdate_enable="YES"
>
> ntpd_sync_on_start="YES" does the same, but it is not an answer to the
> question, it is a workaround.
>

Sure, it's a workaround. Why is it so important to set the CMOS clock if
you can just query the current time from a more accurate source on boot?
The drift on clocks integrated into computers these days is pretty
terrible AFAIK, which is why NTP is so widespread.

Victor Sudakov

unread,
Jul 6, 2014, 11:43:00 PM7/6/14
to
Jesse Gooch wrote:
> >>>
> >>> What's the command to update the CMOS clock to the time of the kernel
> >>> clock?
> >
> > [dd]
> >
> >>>
> >>
> >> To get around this I've started using ntpdate on boot. You can put the
> >> following in your /etc/rc.conf:
> >>
> >> ntpdate_enable="YES"
> >
> > ntpd_sync_on_start="YES" does the same, but it is not an answer to the
> > question, it is a workaround.
> >
>
> Sure, it's a workaround. Why is it so important to set the CMOS clock if
> you can just query the current time from a more accurate source on boot?

Because there are many scenarios where

1) the network is not yet available on boot (at least at the moment
when /etc/rc.d/ntpdate is called);

2) the box has dual boot (e.g. FreeBSD/Windows/DOS whatever) and it
would be nice to have an accurate time in the CMOS clock for the
alternate OS;

3) ... (others can add their own reasons).


> The drift on clocks integrated into computers these days is pretty
> terrible AFAIK, which is why NTP is so widespread.

If the hardware clock is updated maybe daily, I don't expect any
significant drift.

--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
sip:sud...@sibptus.tomsk.ru

Olivier Nicole

unread,
Jul 6, 2014, 11:54:47 PM7/6/14
to
Victor,

>> The drift on clocks integrated into computers these days is pretty
>> terrible AFAIK, which is why NTP is so widespread.
> If the hardware clock is updated maybe daily, I don't expect any
> significant drift.

If all you need is a daily update, why not a cron to restart ntp once
a day? That is a workaround, but as it is only once a day, it is very
cheap resource wise.

best regards,

Olivier

Warren Block

unread,
Jul 7, 2014, 12:50:05 AM7/7/14
to
On Mon, 7 Jul 2014, Victor Sudakov wrote:

> Warren Block wrote:
>>
>>> In other words, what's the FreeBSD equivalent of the Linux
>>> "hwclock --systohc" command?
>>
>> Offhand, I don't know. But date(1) sets both kernel and hardware
>> clocks, so a hacky way to do that is
>>
>> date -v +0S
>
> BTW this command does not set anything, it only displays the time with
> the specified offset.

Whoops, that's true. It would have to pipe that into another instance
of date to actually set the date.

Victor Sudakov

unread,
Jul 7, 2014, 12:57:20 AM7/7/14
to
Olivier Nicole wrote:
>
> >> The drift on clocks integrated into computers these days is pretty
> >> terrible AFAIK, which is why NTP is so widespread.
> > If the hardware clock is updated maybe daily, I don't expect any
> > significant drift.
>
> If all you need is a daily update, why not a cron to restart ntp once
> a day?

Because no matter how often you restart ntp, it does not update the
CMOS (hardware) clock.

My question was about updating the CMOS clock.


--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
sip:sud...@sibptus.tomsk.ru

Matthias Meyser

unread,
Jul 7, 2014, 1:43:06 AM7/7/14
to
Am 07.07.2014 06:57, schrieb Victor Sudakov:
> Olivier Nicole wrote:
>>
>>>> The drift on clocks integrated into computers these days is pretty
>>>> terrible AFAIK, which is why NTP is so widespread.
>>> If the hardware clock is updated maybe daily, I don't expect any
>>> significant drift.
>>
>> If all you need is a daily update, why not a cron to restart ntp once
>> a day?
>
> Because no matter how often you restart ntp, it does not update the
> CMOS (hardware) clock.
>
> My question was about updating the CMOS clock.
>
>
"adjkerntz" does this.

via "/etc/rc" on system boot an shutdown
an via "/etc/crontab" periodically

perhaps you habe "cron" disables on your system?

CU
Matthias

--
Matthias Meyser | XeNET GmbH
Tel.: +49-5323-9489050 | 38678 Clausthal-Zellerfeld, Marktstrasse 40
Fax: +49-5323-9489059 | Registergericht: Amtsgericht Braunschweig HRB
110823
Email: Mey...@xenet.de | Geschaeftsfuehrer: Matthias Meyser

Ralf Mardorf

unread,
Jul 7, 2014, 1:40:44 AM7/7/14
to
On Mon, 2014-07-07 at 11:57 +0700, Victor Sudakov wrote:
> Olivier Nicole wrote:
> > If all you need is a daily update, why not a cron to restart ntp once
> > a day?

The OP ask for a command like Liunx's hwclock, to set up the RTC.

I for example on Linux do it like that:

$ cat /usr/local/bin/tool
[snip]
ntp)
ntpdate ntp.favey.ch
hwclock --set --date "$(date)";;
[snip]

> Because no matter how often you restart ntp, it does not update the
> CMOS (hardware) clock.
>
> My question was about updating the CMOS clock.

"In the last episode (Mar 10), Kelly Jones said:
> What are the FreeBSD equivalents of hwclock (view/set the BIOS
> hardware clock) and adjtimex (adjust clock speed)? I couldn't find
> these two well-known Linux commands in ports?

FreeBSD sets the hardware clock whenever settimeofday() is called
(unless the sysctl machdep.disable_rtc_set is set). I don't think
there's a way to retrieve the current hardware clock settings from
userland.

Linux's adjtimex(2) is called ntp_adjtime(2) in FreeBSD." -
http://lists.freebsd.org/pipermail/freebsd-questions/2007-March/144321.html

Regards,
Ralf

Matthias Apitz

unread,
Jul 7, 2014, 3:07:14 AM7/7/14
to
El día Monday, July 07, 2014 a las 09:10:15AM +0700, Victor Sudakov escribió:

> I have googled up another hacky way of to do that:
>
> sysctl `sysctl -e machdep.adjkerntz`
>
> It's from https://www.mail-archive.com/freebsd-...@freebsd.org/msg03414.html
>
> But I have not found anything to display the CMOS clock, only to set it.

We have in the ports sysutils/dmidecode and I'm wondering, while it
decodes a lot of information from the BIOS, why it does not print the
RTC too... Maybe it could be enhanced to do so?

matthias

--
Matthias Apitz | /"\ ASCII Ribbon Campaign:
E-mail: gu...@unixarea.de | \ / - No HTML/RTF in E-mail
WWW: http://www.unixarea.de/ | X - No proprietary attachments
phone: +49-170-4527211 | / \ - Respect for open standards
| en.wikipedia.org/wiki/ASCII_Ribbon_Campaign

Victor Sudakov

unread,
Jul 7, 2014, 6:39:55 AM7/7/14
to
Ralf Mardorf wrote:
>
> "In the last episode (Mar 10), Kelly Jones said:
> > What are the FreeBSD equivalents of hwclock (view/set the BIOS
> > hardware clock) and adjtimex (adjust clock speed)? I couldn't find
> > these two well-known Linux commands in ports?
>
> FreeBSD sets the hardware clock whenever settimeofday() is called
> (unless the sysctl machdep.disable_rtc_set is set).

I have been told about the machdep.rtc_save_period sysctl, but it seems
undocumented.


--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
sip:sud...@sibptus.tomsk.ru

RW

unread,
Jul 7, 2014, 8:08:16 AM7/7/14
to
On Sun, 6 Jul 2014 22:32:07 +0700
Victor Sudakov wrote:


> And no, contrary to popular belief, the correction of the CMOS clock
> does not happen automatically in FreeBSD even if ntpd is running.

Are you sure about that? That used to be the case, but I thought it was
fixed in 10-CURRENT.

I haven't set my hardware clock manually in more than a year, and it's
out by less than a second.

RW

unread,
Jul 7, 2014, 8:53:30 AM7/7/14
to
On Mon, 7 Jul 2014 13:08:16 +0100
RW wrote:

> On Sun, 6 Jul 2014 22:32:07 +0700
> Victor Sudakov wrote:
>
>
> > And no, contrary to popular belief, the correction of the CMOS clock
> > does not happen automatically in FreeBSD even if ntpd is running.
>
> Are you sure about that? That used to be the case, but I thought it
> was fixed in 10-CURRENT.


I missed this:

On Mon, 7 Jul 2014 17:39:55 +0700
Victor Sudakov wrote:

> I have been told about the machdep.rtc_save_period sysctl, but it
> seems undocumented.


It looks like it has been fixed. I never followed the PR, but the
solution discussed on the mailing list was to update the hardware clock
from the system clock every 30 minutes

$ sysctl -d machdep.rtc_save_period
machdep.rtc_save_period: Save system time to RTC with this period (in seconds)

$ sysctl machdep.rtc_save_period
machdep.rtc_save_period: 1800

Trond Endrestøl

unread,
Jul 7, 2014, 9:15:34 AM7/7/14
to
On Mon, 7 Jul 2014 13:08+0100, RW wrote:

> On Sun, 6 Jul 2014 22:32:07 +0700
> Victor Sudakov wrote:
>
>
> > And no, contrary to popular belief, the correction of the CMOS clock
> > does not happen automatically in FreeBSD even if ntpd is running.
>
> Are you sure about that? That used to be the case, but I thought it was
> fixed in 10-CURRENT.
>
> I haven't set my hardware clock manually in more than a year, and it's
> out by less than a second.

Check out /etc/crontab and the execution of adjkerntz(8).

--
+-------------------------------+------------------------------------+
| Vennlig hilsen, | Best regards, |
| Trond Endrestøl, | Trond Endrestøl, |
| IT-ansvarlig, | System administrator, |
| Fagskolen Innlandet, | Gjøvik Technical College, Norway, |
| tlf. mob. 952 62 567, | Cellular...: +47 952 62 567, |
| sentralbord 61 14 54 00. | Switchboard: +47 61 14 54 00. |
+-------------------------------+------------------------------------+

Ian Smith

unread,
Jul 7, 2014, 9:32:49 AM7/7/14
to
In freebsd-questions Digest, Vol 527, Issue 1, Message: 2
On Sun, 6 Jul 2014 22:32:07 +0700 Victor Sudakov <v...@mpeks.tomsk.su> wrote:
> Colleagues,
>
> What's the command to update the CMOS clock to the time of the kernel
> clock?
>
> ntpd does a good job of keeping the accurate time in the kernel clock,
> but from my experience, this time is not propagated to the CMOS clock
> which lives its own life. As a result, there is a large time skew
> everytime the box is rebooted, which prevents from Kerberos login
> until the kernel clock is synchronized.

That shouldn't be happening. There may be some hardware problem with
your RTC if you haven't messed with the sysctl settings (see below).
Could be a borderline battery, poor quality 32768Hz timebase or ..

> In other words, what's the FreeBSD equivalent of the Linux
> "hwclock --systohc" command?

People have pointed out incantations with date that will do the job, but
it really shouldn't be necessary.

> And no, contrary to popular belief, the correction of the CMOS clock
> does not happen automatically in FreeBSD even if ntpd is running.

Yes, it does. Has since 2.2.6 anyway, whether or not ntpd is running.

In 8.x /var/log/messages gets spammed with RTC update messages every
half hour, if you had booted with verbose messages:

Jul 7 19:34:41 t23 ntpd[65982]: kernel time sync status change 6001
Jul 7 19:45:29 t23 ntpd[65982]: kernel time sync status change 2001
Jul 7 19:46:22 t23 kernel: ts_to_ct(1404762382.687179418) = [2014-07-07 19:46:22]
Jul 7 20:16:22 t23 kernel: ts_to_ct(1404764182.481274525) = [2014-07-07 20:16:22]
Jul 7 20:46:22 t23 kernel: ts_to_ct(1404765982.270411900) = [2014-07-07 20:46:22]
Jul 7 21:16:22 t23 kernel: ts_to_ct(1404767782.058302318) = [2014-07-07 21:16:22]
Jul 7 21:46:21 t23 kernel: ts_to_ct(1404769581.848953320) = [2014-07-07 21:46:21]
Jul 7 22:16:21 t23 kernel: ts_to_ct(1404771381.645923462) = [2014-07-07 22:16:21]

In 9.x there's a new sysctl debug.clocktime to enable such verbosity; I
turned it on about 3 hours ago after seeing this thread, suspended and
resumed to confirm it working, then restarted ntpd for good measure:

Jul 7 19:25:23 x200 ntpd[15232]: ntpd exiting on signal 15
Jul 7 19:25:23 x200 ntpd[15436]: ntpd 4.2.4p5-a (1)
Jul 7 19:25:31 x200 kernel: ts_to_ct(1404761131.551088025) = [2014-07-07 19:25:31]
Jul 7 19:25:31 x200 kernel:
Jul 7 19:25:31 x200 ntpd[15437]: time reset -2.866706 s
Jul 7 19:45:58 x200 kernel: ts_to_ct(1404762359.155395216) = [2014-07-07 19:45:59]
Jul 7 20:15:58 x200 kernel: ts_to_ct(1404764159.155396751) = [2014-07-07 20:15:59]
Jul 7 20:45:58 x200 kernel: ts_to_ct(1404765959.155395746) = [2014-07-07 20:45:59]
Jul 7 21:15:58 x200 kernel: ts_to_ct(1404767759.155397106) = [2014-07-07 21:15:59]
Jul 7 21:45:58 x200 kernel: ts_to_ct(1404769559.155398316) = [2014-07-07 21:45:59]
Jul 7 22:15:58 x200 kernel: ts_to_ct(1404771359.155397764) = [2014-07-07 22:15:59]

> If there is a way to display the time of the CMOS (RTC) clock, I
> would be interested to know too.

True, the above shows when it's updated, but not the amount corrected
(which would require a superfluous read before write, and RTC is slow).
Time can be a bit rough because you can only read or set the RTC to the
nearest second, always rounded down going on the 8.x example above.

From your later message:

> Ralf Mardorf wrote:
> >
> > "In the last episode (Mar 10), Kelly Jones said:
> > > What are the FreeBSD equivalents of hwclock (view/set the BIOS
> > > hardware clock) and adjtimex (adjust clock speed)? I couldn't find
> > > these two well-known Linux commands in ports?
> >
> > FreeBSD sets the hardware clock whenever settimeofday() is called
> > (unless the sysctl machdep.disable_rtc_set is set).
>
> I have been told about the machdep.rtc_save_period sysctl, but it seems
> undocumented.

!sysctl -d machdep | grep rtc
machdep.rtc_save_period: Save system time to RTC with this period (in seconds)
machdep.disable_rtc_set: Disallow adjusting time-of-day clock

!sysctl machdep | grep rtc
machdep.rtc_save_period: 1800
machdep.disable_rtc_set: 0

Do these match yours? And set sysctl debug.clocktime=1 and report back.
I'm not sure whether you need to have also booted with verbose messages
to get the ts_to_ct (and ct_to_ts on booting or resume) messages; I've
been booting verbose mostly lately, maybe you should too if need be; if
there's any problem like failing to update your RTC, it should show up.

A few code references (of many) if you want to dig a bit deeper:
/sys/kern/subr_rtc.c
/sys/kern/subr_clock.c
/sys/sys/clock.h
/sys/x86/isa/atrtc.c
/sys/isa/rtc.h

cheers, Ian

RW

unread,
Jul 7, 2014, 9:40:33 AM7/7/14
to
On Mon, 7 Jul 2014 15:15:34 +0200 (CEST)
Trond Endrestøl wrote:

> On Mon, 7 Jul 2014 13:08+0100, RW wrote:
>
> > On Sun, 6 Jul 2014 22:32:07 +0700
> > Victor Sudakov wrote:
> >
> >
> > > And no, contrary to popular belief, the correction of the CMOS
> > > clock does not happen automatically in FreeBSD even if ntpd is
> > > running.
> >
> > Are you sure about that? That used to be the case, but I thought it
> > was fixed in 10-CURRENT.
> >
> > I haven't set my hardware clock manually in more than a year, and
> > it's out by less than a second.
>
> Check out /etc/crontab and the execution of adjkerntz(8).
>

I run my RTC on UTC so there's no need for adjkerntz ever to change it.
Even if it did it would have been set over 3 months ago, and it's pretty
unlikely that the RTC would still be accurate to 1 second.

As I mentioned in my follow-up it's actually being set every 30
minutes by the kernel. I was pretty sure that someone had worked on a
fix for this, but I wasn't 100% certain that it had been committed -
until I saw the sysctl.

Victor Sudakov

unread,
Jul 7, 2014, 10:18:42 AM7/7/14
to
RW wrote:
>
> > And no, contrary to popular belief, the correction of the CMOS clock
> > does not happen automatically in FreeBSD even if ntpd is running.
>
> Are you sure about that?

I am pretty sure about 8.4-RELEASE.

> That used to be the case, but I thought it was
> fixed in 10-CURRENT.

I really know nothing about CURRENT, maybe you are right and it was
fixed there.

>
> I haven't set my hardware clock manually in more than a year, and it's
> out by less than a second.

My experience is different.

--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
sip:sud...@sibptus.tomsk.ru

Victor Sudakov

unread,
Jul 7, 2014, 10:22:30 AM7/7/14
to
Trond Endrest?l wrote:
>
> > On Sun, 6 Jul 2014 22:32:07 +0700
> > Victor Sudakov wrote:
> >
> >
> > > And no, contrary to popular belief, the correction of the CMOS clock
> > > does not happen automatically in FreeBSD even if ntpd is running.
> >
> > Are you sure about that? That used to be the case, but I thought it was
> > fixed in 10-CURRENT.
> >
> > I haven't set my hardware clock manually in more than a year, and it's
> > out by less than a second.
>
> Check out /etc/crontab and the execution of adjkerntz(8).

According to the man page, "adjkerntz -a" is used to update the local
time CMOS clock and kernel machdep.adjkerntz variable when time zone
changes occur, e.g., when entering or leaving daylight savings time.

Does it to any CMOS clock correction at other times?

BTW Russia is not using daylight savings time, so the changes of
"adjkerntz -a" doing anything useful are slim.

Victor Sudakov

unread,
Jul 7, 2014, 10:33:01 AM7/7/14
to
Ian Smith wrote:
> >
> > What's the command to update the CMOS clock to the time of the kernel
> > clock?
> >
> > ntpd does a good job of keeping the accurate time in the kernel clock,
> > but from my experience, this time is not propagated to the CMOS clock
> > which lives its own life. As a result, there is a large time skew
> > everytime the box is rebooted, which prevents from Kerberos login
> > until the kernel clock is synchronized.
>
> That shouldn't be happening. There may be some hardware problem with
> your RTC if you haven't messed with the sysctl settings (see below).
> Could be a borderline battery, poor quality 32768Hz timebase or ..

Yes, the RTC in that box is not good, therefore the problem. Last time
I rebooted, it had drifted maybe 10-15 minutes for a period of several
months' uptime.

> > In other words, what's the FreeBSD equivalent of the Linux
> > "hwclock --systohc" command?
>
> People have pointed out incantations with date that will do the job, but
> it really shouldn't be necessary.
>
> > And no, contrary to popular belief, the correction of the CMOS clock
> > does not happen automatically in FreeBSD even if ntpd is running.
>
> Yes, it does. Has since 2.2.6 anyway, whether or not ntpd is running.

Sorry, I doubt that.

>
> In 8.x /var/log/messages gets spammed with RTC update messages every
> half hour, if you had booted with verbose messages:
>
> Jul 7 19:34:41 t23 ntpd[65982]: kernel time sync status change 6001
> Jul 7 19:45:29 t23 ntpd[65982]: kernel time sync status change 2001
> Jul 7 19:46:22 t23 kernel: ts_to_ct(1404762382.687179418) = [2014-07-07 19:46:22]

I see ntpd acting here.

> In 9.x there's a new sysctl debug.clocktime to enable such verbosity; I
> turned it on about 3 hours ago after seeing this thread, suspended and
> resumed to confirm it working, then restarted ntpd for good measure:

I don't run ntpd on that box, just ntpdate hourly.

[dd]

>
> Do these match yours? And set sysctl debug.clocktime=1 and report back.

On a 8.4-RELEASE box, I have set sysctl debug.clocktime=1 and waited
for three hours with no trace of any adjustment to the RTC. During
these three hours, ntpdate has been run three times.

However, as soon as I did "sysctl `sysctl -e machdep.adjkerntz`", I
received the following in /var/log/messages:

Jul 7 21:28:34 <kern.crit> fw kernel: ts_to_ct(1404743314.713060410) = [2014-07-07 14:28:34]

What is the conclusion? I think if you are not running ntpd, the only way
to adjust the RTC is running "sysctl `sysctl -e machdep.adjkerntz`".

RW

unread,
Jul 7, 2014, 11:16:03 AM7/7/14
to
On Mon, 7 Jul 2014 21:18:42 +0700
Victor Sudakov wrote:

> RW wrote:
> >
> > > And no, contrary to popular belief, the correction of the CMOS
> > > clock does not happen automatically in FreeBSD even if ntpd is
> > > running.
> >
> > Are you sure about that?
>
> I am pretty sure about 8.4-RELEASE.
>
> > That used to be the case, but I thought it was
> > fixed in 10-CURRENT.
>
> I really know nothing about CURRENT, maybe you are right and it was
> fixed there.


It was four year ago, so I guess that was 9-CURRENT, but it was
definitely MFC'ed into 8-Stable before 8.4.

https://svnweb.freebsd.org/base?view=revision&amp;revision=207360

> > I haven't set my hardware clock manually in more than a year, and
> > it's out by less than a second.
>
> My experience is different.

In another post you wrote:

> I don't run ntpd on that box, just ntpdate hourly.

So how do you know what happens when ntpd is running?

Victor Sudakov

unread,
Jul 7, 2014, 12:11:49 PM7/7/14
to
RW wrote:
>
> In another post you wrote:
>
> > I don't run ntpd on that box, just ntpdate hourly.
>
> So how do you know what happens when ntpd is running?

I admit that I may be mistaken about the ntpd part, or my information
may be outdated.

Since what FreeBSD version does ntpd update the CMOS clock?

I don't run ntpd often, I really prefer to run NTP servers on Cisco
routers and ntpdate on FreeBSD hosts.

--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
sip:sud...@sibptus.tomsk.ru

Ralf Mardorf

unread,
Jul 7, 2014, 12:43:04 PM7/7/14
to
On Mon, 2014-07-07 at 23:11 +0700, Victor Sudakov wrote:
> I don't run ntpd often, I really prefer to run NTP servers on Cisco
> routers and ntpdate on FreeBSD hosts.

ntpd -q

Victor Sudakov

unread,
Jul 7, 2014, 1:19:51 PM7/7/14
to
Ralf Mardorf wrote:
> > I don't run ntpd often, I really prefer to run NTP servers on Cisco
> > routers and ntpdate on FreeBSD hosts.
>
> ntpd -q

"Note: The kernel time discipline is disabled with this option."


--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
sip:sud...@sibptus.tomsk.ru

Ralf Mardorf

unread,
Jul 7, 2014, 1:37:33 PM7/7/14
to
On Tue, 2014-07-08 at 00:19 +0700, Victor Sudakov wrote:
> Ralf Mardorf wrote:
> > > I don't run ntpd often, I really prefer to run NTP servers on Cisco
> > > routers and ntpdate on FreeBSD hosts.
> >
> > ntpd -q
>
> "Note: The kernel time discipline is disabled with this option."

My apologies.
0 new messages