]> git.hungrycats.org Git - linux/commitdiff
[PATCH] missing #if for 1000 HZ
authorAndrew Morton <akpm@osdl.org>
Thu, 14 Aug 2003 17:06:36 +0000 (10:06 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Thu, 14 Aug 2003 17:06:36 +0000 (10:06 -0700)
From: Albert Cahalan <albert@users.sourceforge.net>

This should improve timekeeping a bit @ 1000 HZ.

kernel/timer.c

index 19e03ef778872ea2e36113c7aa75c07e814e4c25..ad4543e5a8714b1ee81168a1b16a1d102db151d7 100644 (file)
@@ -606,6 +606,15 @@ static void second_overflow(void)
     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()" */