All of lore.kernel.org
 help / color / mirror / Atom feed
* missing #if for 1000 HZ
@ 2003-07-23  1:01 Albert Cahalan
  0 siblings, 0 replies; only message in thread
From: Albert Cahalan @ 2003-07-23  1:01 UTC (permalink / raw)
  To: linux-kernel, Ulrich.Windl; +Cc: Andrew Morton, alan

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()" */




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-07-23  0:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-23  1:01 missing #if for 1000 HZ Albert Cahalan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.