diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2017-05-26 08:56:29 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2017-06-02 12:21:35 +1000 |
commit | 1332d883f30e526c091da5e38d24ca6374099f0c (patch) | |
tree | 6f08eb1686a1cdba7658f2987eefa3b8651a7c6f /src | |
parent | 758ffa9c8a8d1c69266ba6658ede4be6852b3e60 (diff) |
Add tv2us helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/evdev.c | 2 | ||||
-rw-r--r-- | src/libinput-util.h | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/evdev.c b/src/evdev.c index 7fac2b2..f0f7906 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1887,7 +1887,7 @@ static inline void evdev_process_event(struct evdev_device *device, struct input_event *e) { struct evdev_dispatch *dispatch = device->dispatch; - uint64_t time = s2us(e->time.tv_sec) + e->time.tv_usec; + uint64_t time = tv2us(&e->time); #if 0 if (libevdev_event_is_code(e, EV_SYN, SYN_REPORT)) diff --git a/src/libinput-util.h b/src/libinput-util.h index e34a500..8d8e3d5 100644 --- a/src/libinput-util.h +++ b/src/libinput-util.h @@ -440,6 +440,12 @@ us2ms(uint64_t us) return (uint32_t)(us / 1000); } +static inline uint64_t +tv2us(const struct timeval *tv) +{ + return s2us(tv->tv_sec) + tv->tv_usec; +} + static inline bool safe_atoi(const char *str, int *val) { |