From 0df0f1fd280ece833f7a0f9ddaba95391d414bcd Mon Sep 17 00:00:00 2001 From: Ove Kaaven <ovek@arcticnet.no> Date: Sun, 11 Apr 1999 17:10:05 +0000 Subject: [PATCH] Teached TIMER_GetNextExpiration that a timer that has already expired (but not processed yet) HAS already expired... --- windows/timer.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/windows/timer.c b/windows/timer.c index e62614e0c01..2124c475c18 100644 --- a/windows/timer.c +++ b/windows/timer.c @@ -195,10 +195,17 @@ static void TIMER_RestartTimer( TIMER * pTimer, DWORD curTime ) */ LONG TIMER_GetNextExpiration(void) { + TIMER *pTimer; LONG retValue; EnterCriticalSection( &csTimer ); - retValue = pNextTimer ? EXPIRE_TIME( pNextTimer, GetTickCount() ) : -1; + + pTimer = pNextTimer; + + while (pTimer && !pTimer->expires) /* Skip already expired timers */ + pTimer = pTimer->next; + + retValue = pTimer ? EXPIRE_TIME( pTimer, GetTickCount() ) : -1; LeaveCriticalSection( &csTimer ); return retValue; -- GitLab