Use nanosleep instead of usleep;
usleep is deprecated and does not exist on some new Linux systems.
#include "platform.h"
-#include <unistd.h>
#include <string.h>
+#include <time.h>
#include "platform_glfw.c.h"
@@ -9,7 +9,11 @@ const char* lovrPlatformGetName() {
}
void lovrPlatformSleep(double seconds) {
- usleep((unsigned int) (seconds * 1000000));
+ seconds += .5e-9;
+ struct timespec t;
+ t.tv_sec = seconds;
+ t.tv_nsec = (seconds - t.tv_sec) * 1e9L;
+ while (nanosleep(&t, &t));
}
void lovrPlatformOpenConsole() {
