Browse Source

engine: linux: simplify Platform_DoubleTime

pull/2/head
Alibek Omarov 5 years ago committed by GitHub
parent
commit
744f75d4a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      engine/platform/linux/sys_linux.c

10
engine/platform/linux/sys_linux.c

@ -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…
Cancel
Save