mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-29 16:24:16 +00:00
engine: linux: simplify Platform_DoubleTime
This commit is contained in:
parent
09203dc512
commit
744f75d4a3
@ -21,18 +21,10 @@ GNU General Public License for more details.
|
|||||||
#if XASH_TIMER == TIMER_LINUX
|
#if XASH_TIMER == TIMER_LINUX
|
||||||
double Platform_DoubleTime( void )
|
double Platform_DoubleTime( void )
|
||||||
{
|
{
|
||||||
static longtime_t g_PerformanceFrequency;
|
|
||||||
static longtime_t g_ClockStart;
|
|
||||||
longtime_t CurrentTime;
|
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
|
||||||
if( !g_PerformanceFrequency )
|
|
||||||
{
|
|
||||||
struct timespec res;
|
|
||||||
if( !clock_getres(CLOCK_MONOTONIC, &res) )
|
|
||||||
g_PerformanceFrequency = 1000000000LL/res.tv_nsec;
|
|
||||||
}
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
|
||||||
return (double) ts.tv_sec + (double) ts.tv_nsec/1000000000.0;
|
return (double) ts.tv_sec + (double) ts.tv_nsec/1000000000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user