mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 20:50:06 +01:00
timer: Warn about negative timer offsets
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@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
6e26493272
commit
98346f6a1a
1 changed files with 4 additions and 1 deletions
|
|
@ -71,7 +71,10 @@ libinput_timer_set(struct libinput_timer *timer, uint64_t expire)
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
uint64_t now = libinput_now(timer->libinput);
|
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,
|
log_bug_libinput(timer->libinput,
|
||||||
"timer offset more than 5s, now %"
|
"timer offset more than 5s, now %"
|
||||||
PRIu64 " expire %" PRIu64 "\n",
|
PRIu64 " expire %" PRIu64 "\n",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue