[parisc-linux-cvs] DIFF -pa6 time.c

Grant Grundler grundler@puffin.external.hp.com
Sat, 17 Nov 2001 00:49:40 -0700


Index: arch/parisc/kernel/time.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/time.c,v
retrieving revision 1.16
diff -u -p -r1.16 time.c
--- arch/parisc/kernel/time.c	2001/09/10 12:53:38	1.16
+++ arch/parisc/kernel/time.c	2001/11/17 07:49:03
@@ -100,18 +100,21 @@ gettimeoffset (void)
 {
 #ifndef CONFIG_SMP
 	/*
-	 * this won't work on smp, because jiffies are updated by cpu 0,
-	 * so we can't use the cr16 value on another processor to get a
-	 * valid offset.
+	 * FIXME: This won't work on smp because jiffies are updated by cpu 0.
+	 *    Once parisc-linux learns the cr16 difference between processors,
+	 *    this could be made to work.
 	 */
 	long last_tick;
 	long elapsed_cycles;
 
-	/* this is the intended time of the next tick */
+	/* it_value is the intended time of the next tick */
 	last_tick = cpu_data[smp_processor_id()].it_value;
-	/* so subtract one tick */
-	/* and account for possible difference between wall and actual time */
-	last_tick += clocktick * (jiffies - wall_jiffies - 1);
+
+	/* Subtract one tick and account for possible difference between
+	 * when we expected the tick and when it actually arrived.
+	 * (aka wall vs real)
+	 */
+	last_tick -= clocktick * (jiffies - wall_jiffies + 1);
 	elapsed_cycles = mfctl(16) - last_tick;
 
 	/* the precision of this math could be improved */