summaryrefslogtreecommitdiff
path: root/src/util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc
index a3fdd1c..b9d57ad 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -38,6 +38,9 @@
#include <string.h>
#include <assert.h>
+// For nanosleep
+#include <time.h>
+
#include "util.h"
void *xmalloc(size_t s)
@@ -68,3 +71,14 @@ void *xrealloc(void *b, size_t s)
}
return p;
}
+
+void sleep_1_frame()
+{
+ // Sleep 1/25th of a second
+
+ struct timespec ts;
+
+ ts.tv_sec = 0;
+ ts.tv_nsec = 1000000000L / 25L; // 1000ms / 25
+ nanosleep(&ts, NULL);
+}