Browse Source

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

pull/2/head
Alibek Omarov 3 years ago
parent
commit
f8e6033ae6
  1. 2
      common/backends.h
  2. 2
      common/defaults.h
  3. 16
      engine/platform/linux/sys_linux.c
  4. 16
      engine/platform/posix/sys_posix.c

2
common/backends.h

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

2
common/defaults.h

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

16
engine/platform/linux/sys_linux.c

@ -18,22 +18,6 @@ GNU General Public License for more details.
#include <fcntl.h> #include <fcntl.h>
#include "platform/platform.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 ) qboolean Sys_DebuggerPresent( void )
{ {
char buf[4096]; char buf[4096];

16
engine/platform/posix/sys_posix.c

@ -153,3 +153,19 @@ void Platform_Init( void )
} }
void Platform_Shutdown( void ) {} void Platform_Shutdown( void ) {}
#endif #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

Loading…
Cancel
Save