[PATCH evemu 3/5] Check tv_usec for offset reset, not just tv_sec
Peter Hutterer
peter.hutterer at who-t.net
Thu Aug 6 17:58:24 PDT 2015
evemu_read_event_realtime() considers a zero time as the first call to this
function that needs to be offset by the current event time. Since
63df84261355, the first event is offset to a timestamp of 0.0.
Thus, all events within the first second are considered offset resets and are
immediately replayed without waiting.
Fix this by checking tv_usec as well as tv_sec.
https://bugzilla.redhat.com/show_bug.cgi?id=1251015
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/evemu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/evemu.c b/src/evemu.c
index 35b2a69..0899b60 100644
--- a/src/evemu.c
+++ b/src/evemu.c
@@ -846,7 +846,7 @@ int evemu_read_event_realtime(FILE *fp, struct input_event *ev,
return ret;
if (evtime) {
- if (!evtime->tv_sec)
+ if (evtime->tv_sec == 0 && evtime->tv_usec == 0)
*evtime = ev->time;
usec = time_to_long(&ev->time) - time_to_long(evtime);
if (usec > 500) {
--
2.4.3
More information about the Input-tools
mailing list