summaryrefslogtreecommitdiff
path: root/src/util/time.h
diff options
context:
space:
mode:
authoraura <nw@moneybot.cc>2026-03-10 01:35:50 +0100
committeraura <nw@moneybot.cc>2026-03-10 01:35:50 +0100
commit8329d42d3e592f4cd42cdfa586e2325ddc76c898 (patch)
treedec7e2a733bfc6b6384936c1f3ed067a42b59bb9 /src/util/time.h
parent8ae8c85e9d3806cdb726e07f37e1b49484c5c48e (diff)
perf profiler, simplify 2d render, string struct, many small things
Diffstat (limited to 'src/util/time.h')
-rw-r--r--src/util/time.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/util/time.h b/src/util/time.h
new file mode 100644
index 0000000..ae696c5
--- /dev/null
+++ b/src/util/time.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#include <SDL.h>
+#include <SDL_timer.h>
+
+#include "typedef.h"
+
+const U32 TICK_RESOLUTION = 1000000;
+
+inline U64 u_tick() {
+ return (SDL_GetPerformanceCounter() * TICK_RESOLUTION / SDL_GetPerformanceFrequency());
+}
+
+inline F32 u_time() {
+ return (F32)((F64)u_tick() / TICK_RESOLUTION);
+}
+
+inline F64 u_time64() {
+ return (F64)u_tick() / TICK_RESOLUTION;
+}
+