diff options
author | Hans de Goede <hdegoede@redhat.com> | 2014-04-08 12:29:45 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2014-05-22 14:51:41 +0200 |
commit | 89165da6d6b90d466edf3283b710c0931bdcc8dd (patch) | |
tree | 35ec258a54fa45da2637cda0f144f3100e8ff08a /src/filter.h | |
parent | ed6ccad449fe07494616e5bf362670907fbbcc8a (diff) | |
download | libinput-89165da6d6b90d466edf3283b710c0931bdcc8dd.tar.gz |
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>
Diffstat (limited to 'src/filter.h')
-rw-r--r-- | src/filter.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/filter.h b/src/filter.h index 6b2a1d20..0ef3d032 100644 --- a/src/filter.h +++ b/src/filter.h @@ -34,13 +34,13 @@ struct motion_filter; void filter_dispatch(struct motion_filter *filter, struct motion_params *motion, - void *data, uint32_t time); + void *data, uint64_t time); struct motion_filter_interface { void (*filter)(struct motion_filter *filter, struct motion_params *motion, - void *data, uint32_t time); + void *data, uint64_t time); void (*destroy)(struct motion_filter *filter); }; @@ -54,7 +54,7 @@ create_linear_acceleration_filter(double speed); typedef double (*accel_profile_func_t)(struct motion_filter *filter, void *data, double velocity, - uint32_t time); + uint64_t time); struct motion_filter * create_pointer_accelator_filter(accel_profile_func_t filter); |