Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Harald Koenig <koenig@tat.physik.uni-tuebingen.de>
Subject: very inaccurate clock for Linux/AXP
Date: Wed, 11 Sep 1996 14:27:53 +0200 (MET DST)	[thread overview]
Message-ID: <199609111646.SAA03089@ceres.tat.physik.uni-tuebingen.de> (raw)

when I got my first alpha (XL266) I was disappointed that the Linux clock was 
off by ~48 seconds every day (~555ppm) and I corrected this "manually"
my setting time_freq using adtimex().

now I did this for a UDB233 and was very surprised that it was exactly 
the same frequency error (again ~48 secs/day or 555ppm) which points to
a systematic error is is (guess what) fixed by the patch below.

first "tick" should be rounded if HZ isn't a divider of 1000000.
for HZ=1024 this gives tick=976.5625 and with rounding up to 977 the
frequency error is 448ppm instead of 576ppm (38sec/day vs. 50sec/day).

the rest of this systematic error can be used as initial value for 
"time_freq" which fixes all the systeamtic error for a free running clock

Harald
-------------------------------------------------------------------------------
--- orig/linux/kernel/sched.c	Tue Sep 10 14:12:32 1996
+++ linux/kernel/sched.c	Wed Sep 11 11:50:04 1996
@@ -43,7 +43,7 @@
 
 int securelevel = 0;			/* system security level */
 
-long tick = 1000000 / HZ;		/* timer interrupt period */
+long tick = (1000000 + HZ/2) / HZ;	/* timer interrupt period */
 volatile struct timeval xtime;		/* The current time */
 int tickadj = 500/HZ;			/* microsecs */
 
@@ -64,7 +64,7 @@
 long time_maxerror = MAXPHASE;	/* maximum error (us) */
 long time_esterror = MAXPHASE;	/* estimated error (us) */
 long time_phase = 0;		/* phase offset (scaled us) */
-long time_freq = 0;		/* frequency offset (scaled ppm) */
+long time_freq = ((1000000 + HZ/2) % HZ - HZ/2) << SHIFT_USEC;	/* frequency offset (scaled ppm) */
 long time_adj = 0;		/* tick adjust (scaled 1 / HZ) */
 long time_reftime = 0;		/* time at last adjustment (s) */
 

-- 
All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \
koenig@tat.physik.uni-tuebingen.de                     ^^^^^       ^^^^^

--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null

                 reply	other threads:[~1996-09-11 12:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox