[PATCH libinput 4/5] timer: Warn about negative timer offsets
Peter Hutterer
peter.hutterer at who-t.net
Mon Jul 27 23:42:41 PDT 2015
On Tue, Jul 28, 2015 at 12:47:05PM +0800, Jonas Ådahl wrote:
> Even if it may be caused by extreme stalls, warn if the timer was set to
> be triggered even before 'now' when it actually is triggered, as it is
> more likely a programming error.
>
> Part of the reason for this commit was not to convert the unsigned int
> to a signed int (which abs() does).
>
> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Cheers,
Peter
> ---
> src/timer.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/timer.c b/src/timer.c
> index 6a343db..a945f78 100644
> --- a/src/timer.c
> +++ b/src/timer.c
> @@ -71,7 +71,10 @@ libinput_timer_set(struct libinput_timer *timer, uint64_t expire)
> {
> #ifndef NDEBUG
> uint64_t now = libinput_now(timer->libinput);
> - if (abs(expire - now) > 5000)
> + if (expire < now)
> + log_bug_libinput(timer->libinput,
> + "timer offset negative\n");
> + else if ((expire - now) > 5000ULL)
> log_bug_libinput(timer->libinput,
> "timer offset more than 5s, now %"
> PRIu64 " expire %" PRIu64 "\n",
> --
> 2.1.0
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
More information about the wayland-devel
mailing list