[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1228823938.11639.7.camel@localhost.localdomain>
Date:	Tue, 09 Dec 2008 17:28:58 +0530
From:	Vinay Sridhar <vinay@...ux.vnet.ibm.com>
To:	linux-kernel@...r.kernel.org
Cc:	jstultz@...ibm.com
Subject: [Patch] Fix sys_time to handle intra-tick correction
Hi All,
This fix changes sys_time to use do_gettimeofday instead of get_seconds.
Running the stime01 test from LTP triggers this error. Calling sys_stime
and then calling sys_time causes this. "do_settimeofday" subtracts the
nsec offset from the nsec value(0 in this case) passed to it.
Subsequently, "set_normalized_timespec" modifies sec and nsec
accordingly. This compensation is handled in the do_gettimeofday path.
However, sys_time does not handle this case and reports an incorrect
seconds value.
signed-off by : Vinay Sridhar <vinay@...ux.vnet.ibm.com>
--- time.c.orig	2008-12-04 06:30:12.000000000 -0600
+++ time.c	2008-12-04 06:31:25.000000000 -0600
@@ -61,7 +61,12 @@ EXPORT_SYMBOL(sys_tz);
  */
 asmlinkage long sys_time(time_t __user * tloc)
 {
-	time_t i = get_seconds();
+	struct timeval t;	
+	time_t i;
+
+	do_gettimeofday(&t);
+
+	i = t.tv_sec;
 
 	if (tloc) {
 		if (put_user(i,tloc))
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists
 
