mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-22 21:04:14 +00:00
engine: move TIMER_LINUX to TIMER_POSIX, enabling dedicated builds for FreeBSD and other *nix platforms
This commit is contained in:
parent
4abe1a77f4
commit
f8e6033ae6
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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];
|
||||||
|
@ -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…
x
Reference in New Issue
Block a user