You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2022/06/22 12:50:22 UTC

svn commit: r1902169 - /apr/apr/trunk/time/win32/time.c

Author: ylavic
Date: Wed Jun 22 12:50:22 2022
New Revision: 1902169

URL: http://svn.apache.org/viewvc?rev=1902169&view=rev
Log:
time: Don't apr_sleep() less than the requested time on WIN32.

Windows' Sleep() has millisecond granularity while the given apr_time_t to
sleep is in microseconds, so round up.

* time/win32/time.c(apr_sleep):
  Round up given time to upper milliseconds.


Modified:
    apr/apr/trunk/time/win32/time.c

Modified: apr/apr/trunk/time/win32/time.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/time/win32/time.c?rev=1902169&r1=1902168&r2=1902169&view=diff
==============================================================================
--- apr/apr/trunk/time/win32/time.c (original)
+++ apr/apr/trunk/time/win32/time.c Wed Jun 22 12:50:22 2022
@@ -268,7 +268,7 @@ APR_DECLARE(void) apr_sleep(apr_interval
     /* One of the few sane situations for a cast, Sleep
      * is in ms, not us, and passed as a DWORD value
      */
-    Sleep((DWORD)(t / 1000));
+    Sleep((DWORD)((t + 999) / 1000));
 }
 
 static apr_status_t clock_restore(void *unsetres)