From: Wanlong Gao <gaowanlong@cn.fujitsu.com>
To: john stultz <johnstul@us.ibm.com>
Cc: linux-input@vger.kernel.org,
"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
"Arve Hjønnevåg" <arve@android.com>
Subject: Re: [RFC][PATCH] Input: Use monotonic time for event time stamps.
Date: Wed, 21 Dec 2011 09:41:50 +0800 [thread overview]
Message-ID: <4EF1395E.405@cn.fujitsu.com> (raw)
In-Reply-To: <1324429303.30527.92.camel@work-vm>
On 12/21/2011 09:01 AM, john stultz wrote:
> Hi
> In reviewing the Android patch set, I noticed the following patch from
> Arve which looks like it resolves a reasonable issue (events using
> CLOCK_REALTIME timestamps, which can jump forwards or backwards via
> settimeofday()).
>
> I'm not very familiar with the evdev interface, so I'm not sure if
> changing the timestamps to CLOCK_MONOTONIC could cause an ABI problem
> with legacy apps. Even so, I wanted to send the patch out for review and
> consideration as it seems like a reasonable fix.
>
> thanks
> -john
>
>
>
>>From 20950b728f120cd808965c1a20b024aa79706d8d Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=3D=3FUTF-8=3Fq=3FArve=3D20Hj=3DC3=3DB8nnev=3DC3=3DA5g=3F=3D?= <arve@android.com>
> Date: Fri, 2 Dec 2011 13:59:05 +0800
> Subject: [PATCH] Input: Use monotonic time for event time stamps.
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> Since wall time can jump backwards, it cannot be used to determine if one
> event occured before another or for how long a key was pressed.
seems reasonable.
>
> CC: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> CC: linux-input@vger.kernel.org
> Signed-off-by: Arve Hjønnevåg <arve@android.com>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
> drivers/input/evdev.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
> index 4cf2534..ec329b4 100644
> --- a/drivers/input/evdev.c
> +++ b/drivers/input/evdev.c
> @@ -94,8 +94,11 @@ static void evdev_event(struct input_handle *handle,
> struct evdev *evdev = handle->private;
> struct evdev_client *client;
> struct input_event event;
> + struct timespec ts;
>
> - do_gettimeofday(&event.time);
> + ktime_get_ts(&ts);
> + event.time.tv_sec = ts.tv_sec;
> + event.time.tv_usec = ts.tv_nsec / NSEC_PER_USEC;
> event.type = type;
> event.code = code;
> event.value = value;
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2011-12-21 1:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-21 1:01 [RFC][PATCH] Input: Use monotonic time for event time stamps john stultz
2011-12-21 1:41 ` Wanlong Gao [this message]
2011-12-21 2:11 ` Daniel Kurtz
2011-12-21 2:23 ` john stultz
2011-12-21 3:34 ` Daniel Kurtz
2011-12-21 7:53 ` john stultz
2011-12-21 8:54 ` Daniel Kurtz
2011-12-21 2:29 ` john stultz
2011-12-21 3:23 ` Daniel Kurtz
2011-12-21 3:12 ` 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=4EF1395E.405@cn.fujitsu.com \
--to=gaowanlong@cn.fujitsu.com \
--cc=arve@android.com \
--cc=dmitry.torokhov@gmail.com \
--cc=johnstul@us.ibm.com \
--cc=linux-input@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 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.