diff --git a/windows/timer.c b/windows/timer.c index e62614e0c01e59fcf48b8d70a3b5128c124be20c..2124c475c18408087b40edb04c179696fbe83353 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;