From 7ac7047ddb1e32c0ee49ebfee6bf4ac3ed6b48f3 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Fri, 16 Aug 2024 05:38:23 +0200 Subject: [PATCH] Make Sys_Milliseconds() inline it only returns Sys_MillisecondsPrecise() casted to unsigned int anyway. --- neo/sys/sys_public.h | 10 ++++++---- neo/sys/threads.cpp | 9 --------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/neo/sys/sys_public.h b/neo/sys/sys_public.h index 11e3fb15..e76d9ee9 100644 --- a/neo/sys/sys_public.h +++ b/neo/sys/sys_public.h @@ -159,13 +159,15 @@ void Sys_DebugVPrintf( const char *fmt, va_list arg ); // NOTE: due to SDL_TIMESLICE this is very bad portability karma, and should be completely removed void Sys_Sleep( int msec ); -// Sys_Milliseconds should only be used for profiling purposes, -// any game related timing information should come from event timestamps -unsigned int Sys_Milliseconds( void ); - // like Sys_Milliseconds(), but with higher precision double Sys_MillisecondsPrecise( void ); +// Sys_Milliseconds should only be used for profiling purposes, +// any game related timing information should come from event timestamps +ID_INLINE unsigned int Sys_Milliseconds( void ) { + return (unsigned int)Sys_MillisecondsPrecise(); +} + // sleep until Sys_MillisecondsPrecise() returns >= targetTimeMS // aims for about 0.01ms precision (but might busy wait for the last 1.5ms or so) void Sys_SleepUntilPrecise( double targetTimeMS ); diff --git a/neo/sys/threads.cpp b/neo/sys/threads.cpp index dc030b93..4b242e43 100644 --- a/neo/sys/threads.cpp +++ b/neo/sys/threads.cpp @@ -68,15 +68,6 @@ void Sys_Sleep(int msec) { SDL_Delay(msec); } -/* -================ -Sys_Milliseconds -================ -*/ -unsigned int Sys_Milliseconds() { - return (unsigned int)Sys_MillisecondsPrecise(); -} - /* ================== Sys_InitThreads