[unix-pc.general] Accurate Timekeeping

vince@tc.fluke.COM (Craig Johnson) (12/01/88)

I have gotten tired of my 7300 keeping inaccurate time.

A long time ago there was a program floating around which caused a
daemon to start up which applied periodic adjustments to the system
time.  Was this ever posted here or was it a commercial product?  If
it is public domain could someone send me a copy or repost it?  Does
anyone know if this program updates the real time clock hardware, or
only the system time kept in software?

If this doesn't show up, there may be a way to easily improve your
system's timekeeping anyway.  It turns out that the system time is only
set (read from the real time clock hardware) on boot-up.  This is
performed by "date -" being executed by root.  From that time forward
until the next reboot, the system time is based on a different clock
source.  I haven't looked at the hardware manual yet to figure out if
it is the microprocessor clock or yet another clock (for time slice
interrupts?), but it is definitely different from what the RTC hardware
sees.

If your Unix-pc has been up for a while, login as someone other than
root and type,

	$ date -; date

"Date -" cannot change your system time since you are not root, but it
will print out the time found in the real time clock hardware.  If the
hardware clock and the system clock (software) were keeping the same
time you would expect the second date command to spit out a time which
follows the first time by a couple of seconds.  On my 7300 the time is
considerably different, and it is the RTC value which tracks reality
closest.

So here is the proposal:  If I can't get the time correction daemon
program I'm looking for, I propose to add a line to my crontab which
will execute "date -" once a day, thereby setting the system time to
the RTC value daily.  This should make life more tolerable for me,
perhaps it will help others also.  I'm making the assumption here that
crontab is executed by smgr or cron which has root privileges.

We'll see if this is good enough.  If not, I will look into writing
my own time correction daemon.  I'll let you know if it comes to that.


	Craig V. Johnson		...!fluke!vince
	John Fluke Mfg. Co.
	Everett, WA

clb@loci.UUCP (Charles Brunow) (12/02/88)

In article <6163@fluke.COM>, vince@tc.fluke.COM (Craig Johnson) writes:
> I have gotten tired of my 7300 keeping inaccurate time.
> 
> A long time ago there was a program floating around which caused a
> daemon to start up which applied periodic adjustments to the system
> time.  Was this ever posted here or was it a commercial product?  If
> it is public domain could someone send me a copy or repost it?  Does
> anyone know if this program updates the real time clock hardware, or
> only the system time kept in software?
> 

	You should have received the file "fixRTC.c" by now.  I used
	to have it in a shar with instructions but, ... 

	I'm curious about the errors y'all are having; my system runs
	about 30 sec/wk fast and varies with season.  I've been keeping
	up with the rate for a good while now and my guess is that temp
	is the variable.  Anyway, fixRTC keeps my system running within
	about 5 secs of the WWV times if I check and diddle it monthly.
	Who else has some data?

-- 
--
#_\_@\\/\_@\\/\_@\            Charles Brunow                   Loci Products
# /--u// --u// --o/            clb@loci.UUCP                  POB 833846-131
# _ __  _ _ __  __ __   ..!uunet!texbell!loci!clb    Richardson, Texas 75083

cdold@starfish.Convergent.COM (Clarence Dold) (12/02/88)

From article <6163@fluke.COM>, by vince@tc.fluke.COM (Craig Johnson):
> I have gotten tired of my 7300 keeping inaccurate time.
[ ... ]
> If your Unix-pc has been up for a while, login as someone other than
> root and type,
> 
> 	$ date -; date
> 
The newer Convergent Systems do have such a line in the crontab:

0 4 * * * (echo "setting the system date\nfrom: \c"; date; date -; echo "to: \c"; date) >/dev/console
-- 
Clarence A Dold - cdold@starfish.Convergent.COM         (408) 434-2083
                ...pyramid!ctnews!professo!dold         MailStop 18-011
                P.O.Box 6685, San Jose, CA 95150-6685
-- 
Clarence A Dold - cdold@starfish.Convergent.COM         (408) 434-2083
                ...pyramid!ctnews!professo!dold         MailStop 18-011
                P.O.Box 6685, San Jose, CA 95150-6685

thad@cup.portal.com (Thad P Floryan) (12/06/88)

True; the UNIXpc, when left up 30+ days at a time, does tend to advance its
clock more than is desirable.

Several months ago I modified the "utc" program that was posted to, perhaps,
comp.sources.misc, to correct the problem.

I run the corrected version every Sunday morning; it calls the US Naval
Observatry in Washington, DC and adjusts BOTH the time-of-day-clock AND the
battery-backed real-time-clock.

I'll be posting this shortly to unix-pc.sources; been working the proverbial
25 hrs/day, 7 days/week recently and need to first catch up on the 50+ 
newsgroups to which I subsribe.

Thad Floryan [thad@cup.portal.com (OR) ...!sun!portal!cup.portal.com!thad]