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);