summaryrefslogtreecommitdiff
path: root/src/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/timer.c')
-rw-r--r--src/timer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/timer.c b/src/timer.c
index 4e38c52..9718b22 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -63,7 +63,7 @@ static long currentTime()
static void SetNewTimeout( unsigned long current, unsigned long when )
{
unsigned long time;
- time = when - current;
+ time = (when <= current) ? 0 : when - current;
nextTimeout = when;
selectTimeout.tv_sec = time / MILLISEC;
selectTimeout.tv_usec = (time - selectTimeout.tv_sec* MILLISEC) * MILLISEC;