Skip to contentSkip to conversation

missing #if for 1000 HZ

PATCH Albert Cahalan 1 participant 1 message Jul 23, 2003

lore
Share & tools
lore
#0 lore raw

This should improve timekeeping a bit @ 1000 HZ.

kernel/timer.c +9 -0
diff -Naurd old/kernel/timer.c new/kernel/timer.c
@@ -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()" */