From 1f2b1656afdbe2209169944cf1305b95f0647c04 Mon Sep 17 00:00:00 2001 From: onelin Date: Fri, 14 Mar 2025 10:05:21 +0100 Subject: Use usec? --- src/rendering/src/window.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/rendering') 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; } -- cgit v1.3