From 8329d42d3e592f4cd42cdfa586e2325ddc76c898 Mon Sep 17 00:00:00 2001 From: aura Date: Tue, 10 Mar 2026 01:35:50 +0100 Subject: perf profiler, simplify 2d render, string struct, many small things --- src/util/time.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/util/time.h (limited to 'src/util/time.h') 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 +#include + +#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; +} + -- cgit v1.2.3