Change internal timestamps to uint64_t to properly deal with wrapping
authorHans de Goede <hdegoede@redhat.com>
Tue, 8 Apr 2014 10:29:45 +0000 (12:29 +0200)
committerHans de Goede <hdegoede@redhat.com>
Thu, 22 May 2014 12:51:41 +0000 (14:51 +0200)
commit89165da6d6b90d466edf3283b710c0931bdcc8dd
tree35ec258a54fa45da2637cda0f144f3100e8ff08a
parented6ccad449fe07494616e5bf362670907fbbcc8a
Change internal timestamps to uint64_t to properly deal with wrapping

We store timestamps in ms since system boot (CLOCK_MONOTONIC). This will wrap
after circa 50 days.

I've considered making our code wrapping safe, but that won't work. We also
use our internal timestamps to program timer-fds for timeouts. And we store
ms in a single integer but the kernel uses 2 integers, one for seconds and
one for usec/nanosec. So at 32 bits our ms containing integer will wrap
in 50 days, while the kernels seconds storing integer lasts a lot longer.
So when we wrap our ms timestamps, we will be programming the timer-fds
with a seconds value in the past.

So change all our internal timestamps to uint64_t to avoid the wrapping
when programming the timer-fds. Note that we move from 64-bit timestamps to
32-bit timestamps when calling the foo_notify_bar functions from
libinput-private.h. Having 64 bit timestamps has no use past this point,
since the wayland input protocol uses 32 bit timestamps (and clients will
have to deal with wrapping).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev-mt-touchpad-buttons.c
src/evdev-mt-touchpad-tap.c
src/evdev-mt-touchpad.c
src/evdev-mt-touchpad.h
src/evdev-touchpad.c
src/evdev.c
src/evdev.h
src/filter.c
src/filter.h