From: Vinay Sridhar <vinay@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: jstultz@us.ibm.com
Subject: [Patch] Fix sys_time to handle intra-tick correction
Date: Tue, 09 Dec 2008 17:28:58 +0530 [thread overview]
Message-ID: <1228823938.11639.7.camel@localhost.localdomain> (raw)
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@linux.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))
next reply other threads:[~2008-12-09 12:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-09 11:58 Vinay Sridhar [this message]
2008-12-10 0:24 ` john stultz
2008-12-10 2:25 ` john stultz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1228823938.11639.7.camel@localhost.localdomain \
--to=vinay@linux.vnet.ibm.com \
--cc=jstultz@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®