brought back functionality from previous builds but now cross-platform
This commit is contained in:
@@ -24,7 +24,11 @@ PLATFORM_INTERFACE void Plat_FatalErrorFunc(const char* szFormat, ...)
|
||||
V_vprintf(szFormat, list);
|
||||
va_end(list);
|
||||
fflush(stdout);
|
||||
#ifdef __WIN32__
|
||||
__debugbreak();
|
||||
#else
|
||||
raise(SIGTRAP);
|
||||
#endif
|
||||
Plat_Exit(1);
|
||||
}
|
||||
|
||||
@@ -200,11 +204,29 @@ PLATFORM_INTERFACE void Plat_UnloadLibrary( void *lib )
|
||||
|
||||
PLATFORM_INTERFACE double Plat_GetTime( void )
|
||||
{
|
||||
#ifndef __WIN32__
|
||||
struct timespec tp;
|
||||
clock_gettime(CLOCK_MONOTONIC, &tp);
|
||||
static time_t s_starttime = tp.tv_sec;
|
||||
|
||||
return (tp.tv_sec-s_starttime)+tp.tv_nsec/1e9;
|
||||
#else
|
||||
static LARGE_INTEGER s_startcount;
|
||||
static LARGE_INTEGER s_frequency;
|
||||
static int s_initialized = 0;
|
||||
|
||||
LARGE_INTEGER tp;
|
||||
|
||||
if (!s_initialized) {
|
||||
QueryPerformanceFrequency(&s_frequency);
|
||||
QueryPerformanceCounter(&s_startcount);
|
||||
s_initialized = 1;
|
||||
}
|
||||
|
||||
QueryPerformanceCounter(&tp);
|
||||
|
||||
return (double)(tp.QuadPart - s_startcount.QuadPart) / s_frequency.QuadPart;
|
||||
#endif
|
||||
}
|
||||
|
||||
PLATFORM_INTERFACE void Plat_Exit( int status )
|
||||
@@ -215,4 +237,7 @@ PLATFORM_INTERFACE void Plat_Exit( int status )
|
||||
#ifdef __APPLE__
|
||||
_exit(status);
|
||||
#endif
|
||||
#ifdef __WIN32__
|
||||
_exit(status);
|
||||
#endif
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user