[PATCH] time interpolator: Fix settimeofday inaccuracy

From: Christoph Lameter <clameter_at_engr.sgi.com>
Date: 2005-04-28 04:44:20
settimeofday will set the time a little bit too early on systems using
time interpolation since it subtracts the current interpolator offset
from the time. This used to be necessary with the code in 2.6.9 and earlier
but the new code resets the time interpolator after setting the time.
Thus the time is set too early and gettimeofday will return a time slightly
before the time specified with settimeofday if invoked immeditely after
settimeofday.

The following patch removes the obsolete subtraction of the time interpolator
offset and makes settimeofday set the time accurately.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.11/kernel/time.c
===================================================================
--- linux-2.6.11.orig/kernel/time.c	2005-03-01 23:37:50.000000000 -0800
+++ linux-2.6.11/kernel/time.c	2005-04-26 18:06:03.000000000 -0700
@@ -505,14 +505,6 @@

 	write_seqlock_irq(&xtime_lock);
 	{
-		/*
-		 * This is revolting. We need to set "xtime" correctly. However, the value
-		 * in this location is the value at the most recent update of wall time.
-		 * Discover what correction gettimeofday would have done, and then undo
-		 * it!
-		 */
-		nsec -= time_interpolator_get_offset();
-
 		wtm_sec  = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
 		wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Apr 27 14:49:22 2005

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:37 EST