summaryrefslogtreecommitdiff
path: root/src/rendering
diff options
context:
space:
mode:
authoronelin <oscar@nelin.dk>2025-03-14 09:05:21 +0000
committeronelin <oscar@nelin.dk>2025-03-15 17:13:56 +0000
commit1f2b1656afdbe2209169944cf1305b95f0647c04 (patch)
treefbe9439b1c29f3179288319442901af1dee273cd /src/rendering
parent40593e796e64a25efb97b158453f053fb77f95b3 (diff)
Use usec?
Diffstat (limited to 'src/rendering')
-rw-r--r--src/rendering/src/window.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/rendering/src/window.c b/src/rendering/src/window.c
index 8514bb4..5bb01b0 100644
--- a/src/rendering/src/window.c
+++ b/src/rendering/src/window.c
@@ -66,18 +66,18 @@ static inline u64 glfw_gettime_msec() {
}
/* Should honestly just write my own */
-static inline u64 glfw_gettime_nsec() {
- return (f64)glfwGetTime() * 1000000000;
+static inline u64 glfw_gettime_usec() {
+ return (f64)glfwGetTime() * 1000000;
}
-static inline u64 platform_get_time() {
+static inline u64 platform_get_time_usec() {
struct timespec t;
int res = clock_gettime(CLOCK_MONOTONIC, &t);
if (res != 0) {
// TODO: Check errno
WARN("Failed to get system time");
}
- return t.tv_sec * 1000000000 + t.tv_nsec;
+ return (t.tv_sec * 1000000) + (t.tv_nsec / 1000);
}
Window* init_window_glfw(
@@ -145,7 +145,8 @@ Window* init_window_glfw(
ret->context = NULL;
window_poll_events = &glfwPollEvents;
- get_time = &platform_get_time;
+ //get_time = &platform_get_time_usec;
+ get_time = &platform_get_time_usec;
return ret;
}