Skip to content

Commit

Permalink
win32: fix delay rounding error
Browse files Browse the repository at this point in the history
Delay must be rounded up, not down.
  • Loading branch information
Rémi Denis-Courmont committed May 27, 2016
1 parent 5daf669 commit 113ded6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/win32/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ void vlc_cond_wait(vlc_cond_t *wait, vlc_mutex_t *lock)

int vlc_cond_timedwait(vlc_cond_t *wait, vlc_mutex_t *lock, mtime_t deadline)
{
return vlc_cond_wait_delay(wait, lock, (deadline - mdate()) / 1000);
return vlc_cond_wait_delay(wait, lock, (deadline + 999 - mdate()) / 1000);
}

int vlc_cond_timedwait_daytime(vlc_cond_t *wait, vlc_mutex_t *lock,
Expand Down Expand Up @@ -771,7 +771,7 @@ void mwait (mtime_t deadline)
vlc_testcancel();
while ((delay = (deadline - mdate())) > 0)
{
delay /= 1000;
delay = (delay + 999) / 1000;
if (unlikely(delay > 0x7fffffff))
delay = 0x7fffffff;
vlc_Sleep (delay);
Expand Down

0 comments on commit 113ded6

Please sign in to comment.