mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
28 lines
620 B
Diff
28 lines
620 B
Diff
|
diff --git a/src/utils/timer.c b/src/utils/timer.c
|
||
|
index 9978a99..c94d33d 100644
|
||
|
--- a/src/utils/timer.c
|
||
|
+++ b/src/utils/timer.c
|
||
|
@@ -48,20 +48,13 @@ long getUs(struct timeval timer) {
|
||
|
return ((tmr2.tv_sec - timer.tv_sec) * 1000000) + (tmr2.tv_usec - timer.tv_usec);
|
||
|
}
|
||
|
|
||
|
+#include <unistd.h>
|
||
|
+
|
||
|
/**
|
||
|
Sleep for a given amount of milliseconds
|
||
|
|
||
|
@param ms Milliseconds to sleep for
|
||
|
*/
|
||
|
void sleepMSec(int ms) {
|
||
|
-#ifdef WINDOWS
|
||
|
- Sleep(ms);
|
||
|
-#elif __APPLE__
|
||
|
- struct timespec ts;
|
||
|
- ts.tv_sec = ms / 1000;
|
||
|
- ts.tv_nsec = (ms % 1000) * 1000000;
|
||
|
- nanosleep(&ts, NULL);
|
||
|
-#elif __linux__
|
||
|
usleep(ms * 1000);
|
||
|
-#endif
|
||
|
}
|