summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2018-05-03 12:18:22 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2018-05-03 12:20:03 +1000
commitd140bb7c2d542874698dbd31958d35d065327bcd (patch)
tree335e4bafa34b18503575fe96b7b4bc48ee1c12f2 /tools
parent1392c1f3ac4f148b8597436d622ae1d228aef4f5 (diff)
tools: libinput-record: move the event time offset to the first place we get it
Leftover from a previous version where printing and handling an event was identical. Now we may handle events but not actually print them until a bit later, so other events may have a (wrong) zero timestamp. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/libinput-record.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/libinput-record.c b/tools/libinput-record.c
index fed63ca2..33bb47fb 100644
--- a/tools/libinput-record.c
+++ b/tools/libinput-record.c
@@ -193,8 +193,6 @@ print_evdev_event(struct record_context *ctx, struct input_event *ev)
bool was_modified = false;
char desc[1024];
- if (ctx->offset == 0)
- ctx->offset = tv2us(&ev->time);
ev->time = us2tv(tv2us(&ev->time) - ctx->offset);
/* Don't leak passwords unless the user wants to */
@@ -269,6 +267,9 @@ handle_evdev_frame(struct record_context *ctx, struct record_device *d)
LIBEVDEV_READ_FLAG_NORMAL,
&e) == LIBEVDEV_READ_STATUS_SUCCESS) {
+ if (ctx->offset == 0)
+ ctx->offset = tv2us(&e.time);
+
if (d->nevents == d->events_sz)
resize(d->events, d->events_sz);