summaryrefslogtreecommitdiff
path: root/src/os_win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os_win32.c')
-rw-r--r--src/os_win32.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/os_win32.c b/src/os_win32.c
index 48cc4c5dc..4013353cf 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -1357,9 +1357,10 @@ WaitForChar(long msec)
if (msec > 0)
{
- /* If the specified wait time has passed, return. */
+ /* If the specified wait time has passed, return. Beware that
+ * GetTickCount() may wrap around (overflow). */
dwNow = GetTickCount();
- if (dwNow >= dwEndTime)
+ if ((int)(dwNow - dwEndTime) >= 0)
break;
}
if (msec != 0)