engine: move TIMER_LINUX to TIMER_POSIX, enabling dedicated builds for FreeBSD and other *nix platforms

This commit is contained in:
Alibek Omarov 2021-06-26 00:19:49 +03:00
parent 4abe1a77f4
commit f8e6033ae6
4 changed files with 18 additions and 18 deletions

View File

@ -44,7 +44,7 @@ GNU General Public License for more details.
// timer (XASH_TIMER)
#define TIMER_NULL 0 // not used
#define TIMER_SDL 1
#define TIMER_LINUX 2
#define TIMER_POSIX 2
#define TIMER_WIN32 3
#define TIMER_DOS 4

View File

@ -128,7 +128,7 @@ SETUP BACKENDS DEFINITIONS
#if XASH_WIN32
#define XASH_TIMER TIMER_WIN32
#else // !XASH_WIN32
#define XASH_TIMER TIMER_LINUX
#define XASH_TIMER TIMER_POSIX
#endif // !XASH_WIN32
#endif

View File

@ -18,22 +18,6 @@ GNU General Public License for more details.
#include <fcntl.h>
#include "platform/platform.h"
#if XASH_TIMER == TIMER_LINUX
double Platform_DoubleTime( void )
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return (double) ts.tv_sec + (double) ts.tv_nsec/1000000000.0;
}
void Platform_Sleep( int msec )
{
usleep( msec * 1000 );
}
#endif // XASH_TIMER == TIMER_LINUX
qboolean Sys_DebuggerPresent( void )
{
char buf[4096];

View File

@ -153,3 +153,19 @@ void Platform_Init( void )
}
void Platform_Shutdown( void ) {}
#endif
#if XASH_TIMER == TIMER_POSIX
double Platform_DoubleTime( void )
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return (double) ts.tv_sec + (double) ts.tv_nsec/1000000000.0;
}
void Platform_Sleep( int msec )
{
usleep( msec * 1000 );
}
#endif // XASH_TIMER == TIMER_POSIX