system clock & cmos clock

system clock & cmos clock

Post by Otavio Exe » Wed, 01 Oct 1997 04:00:00



hi everybody,

what's the relation between the system clock and the cmos clock when no
'clock -[u]a' is issued?

yesterday I followed the instructions on 'man clock'; today I checked
the system time and it was 00:26s ahead; then I issued a 'clock -s' and
after that the system clock was 00:03s behind!

I understand I must set the first parameter in /etc/adjtime to 3 and set
/etc/crontab to run 'clock -ua' regularly; thats fine!

the problem is: if cron runs 'clock -ua' *ONCE* a day I'll have a 00:29s
"gap" that could confuse programs like make; do I have to run 'clock
-ua' every 10 minutes? is there a way to tune the system clock to be
closer to the cmos clock so that 'clock -au' won't cause such a huge
gap?

TIA!

Otavio Exel /<\oo/>\

 
 
 

system clock & cmos clock

Post by Pat Thoyt » Wed, 01 Oct 1997 04:00:00



> hi everybody,

> what's the relation between the system clock and the cmos clock when no

[snip]

There is a mini HOWTO for setting up /etc/adjtime using clock(8). That
should answer most of your questions.

--
Pat Thoyts                      Remove anti-spam from address to reply.
       PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

 
 
 

system clock & cmos clock

Post by Ron Be » Wed, 01 Oct 1997 04:00:00



>what's the relation between the system clock and the cmos clock when no
>'clock -[u]a' is issued?

They are (usually) run by separate crystals, so they will drift
at different rates. The only thing special about the CMOS clock
is that it keeps running when the machine is turned off.
Everything except clock(8) uses the system clock.

Quote:>the problem is: if cron runs 'clock -ua' *ONCE* a day I'll have a 00:29s
>"gap" that could confuse programs like make; do I have to run 'clock
>-ua' every 10 minutes? is there a way to tune the system clock to be
>closer to the cmos clock so that 'clock -au' won't cause such a huge
>gap?

You should have cron run it as often as necessary to keep your
system stable. I don't see any problem with running it every 10
minutes. You're gaining approximately 1 sec every 50 min, so once
or twice per hour might be enough.

The xntpd package includes a way to tune the system clock
(or "kernel clock"), but it's more complicated than clock(8).
Check out http://www.eecis.udel.edu/~ntp/ and if you still have
questions try comp.protocols.time.ntp. If you decide to run
xntpd, you should set the correction factor in /etc/adjtime to 0
and remove clock(8) from your cron file.

You might be able to use the "adjtimex" system call to "roll your
own", but if you have the skills for that you'll probably just
want to run xntpd anyway :-).