Input: Use monotonic time for event time stamps.
authorArve Hjønnevåg <arve@android.com>
Fri, 17 Oct 2008 22:28:08 +0000 (15:28 -0700)
committerColin Cross <ccross@android.com>
Tue, 14 Jun 2011 16:08:45 +0000 (09:08 -0700)
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 <arve@android.com>
drivers/input/evdev.c

index 1f571d73d9f2f2281992a4455893f0c8a08ee077..809ebebf4d1ef28b6e06b5fad8ce4d61cf29cfe5 100644 (file)
@@ -97,8 +97,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;