From 36c83de7181079b3e5ce339c6d15172adaab960a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= Date: Fri, 17 Oct 2008 15:28:08 -0700 Subject: [PATCH] Input: Use monotonic time for event time stamps. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 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. Signed-off-by: Arve Hjønnevåg --- drivers/input/evdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 98bb5be0a6d1..3a24ed442466 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -81,8 +81,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; -- 2.34.1