Skip to content

Commit

Permalink
Make Sys_Milliseconds() inline
Browse files Browse the repository at this point in the history
it only returns Sys_MillisecondsPrecise() casted to unsigned int anyway
  • Loading branch information
DanielGibson committed Dec 28, 2024
1 parent b158f24 commit 43f63af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
10 changes: 6 additions & 4 deletions neo/sys/sys_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
9 changes: 0 additions & 9 deletions neo/sys/threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 43f63af

Please sign in to comment.