Re: [RFC][PATCH] Input: Use monotonic time for event time stamps.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 21, 2011 at 9:41 AM, Wanlong Gao <gaowanlong@xxxxxxxxxxxxxx> wrote:
> 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.

Maybe you will have more luck this time.  You can read the previous
thread on this exact topic, here:
https://lkml.org/lkml/2011/10/3/37

The previous attempt got bogged down when people wanted more data on
use cases and how this patch would promote world peace.  I strongly
support the concept, but we found other ways to address our major
concern at the time, so didn't invest more effort to get that patch
accepted.

Just a question though, why ktime_get_ts() and not getrawmonotonic()?

Thanks!

>>
>> 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@xxxxxxxxxxx>
>> 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@xxxxxxxxx>
>> CC: linux-input@xxxxxxxxxxxxxxx
>> Signed-off-by: Arve Hjønnevåg <arve@xxxxxxxxxxx>
>> Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
>> ---
>>  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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux