public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Albert Cahalan <albert@users.sf.net>
To: linux-kernel@vger.kernel.org, Ulrich.Windl@rz.uni-regensburg.de
Cc: Andrew Morton <akpm@digeo.com>, alan@redhat.com
Subject: missing #if for 1000 HZ
Date: 22 Jul 2003 21:01:16 -0400	[thread overview]
Message-ID: <1058921711.944.24.camel@cube> (raw)

This should improve timekeeping a bit @ 1000 HZ.


diff -Naurd old/kernel/timer.c new/kernel/timer.c
--- old/kernel/timer.c	2003-07-18 17:27:01.000000000 -0400
+++ new/kernel/timer.c	2003-07-18 17:32:19.000000000 -0400
@@ -606,6 +606,15 @@
     else
 	time_adj += (time_adj >> 2) + (time_adj >> 5);
 #endif
+#if HZ == 1000
+    /* Compensate for (HZ==1000) != (1 << SHIFT_HZ).
+     * Add 1.5625% and 0.78125% to get 1023.4375; => only 0.05% error (p. 14)
+     */
+    if (time_adj < 0)
+	time_adj -= (-time_adj >> 6) + (-time_adj >> 7);
+    else
+	time_adj += (time_adj >> 6) + (time_adj >> 7);
+#endif
 }
 
 /* in the NTP reference this is called "hardclock()" */




                 reply	other threads:[~2003-07-23  0:55 UTC|newest]

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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1058921711.944.24.camel@cube \
    --to=albert@users.sf.net \
    --cc=Ulrich.Windl@rz.uni-regensburg.de \
    --cc=akpm@digeo.com \
    --cc=alan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox