Fix pager live updates if millisecond time is initially "negative"

This commit is contained in:
Kim Woelders 2021-03-07 19:31:35 +01:00
parent 9d678fc554
commit 84baa86492
1 changed files with 3 additions and 4 deletions

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2020 Kim Woelders * Copyright (C) 2004-2021 Kim Woelders
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to * of this software and associated documentation files (the "Software"), to
@ -833,8 +833,7 @@ static void
PagersCheckUpdate(void) PagersCheckUpdate(void)
{ {
static unsigned int tms_last = 0; static unsigned int tms_last = 0;
unsigned int tms; unsigned int tms, dtms;
int dtms;
if (!Mode_pagers.update_pending || !Conf_pagers.enable) if (!Mode_pagers.update_pending || !Conf_pagers.enable)
return; return;
@ -843,7 +842,7 @@ PagersCheckUpdate(void)
{ {
tms = GetTimeMs(); tms = GetTimeMs();
dtms = (Conf_pagers.scanspeed > 0) ? 1000 / Conf_pagers.scanspeed : 100; dtms = (Conf_pagers.scanspeed > 0) ? 1000 / Conf_pagers.scanspeed : 100;
if ((int)(tms - tms_last) < dtms) if ((unsigned int)(tms - tms_last) < dtms)
{ {
/* The purpose of this timer is to trigger the idler */ /* The purpose of this timer is to trigger the idler */
if (Mode_pagers.timer_pending) if (Mode_pagers.timer_pending)