engine: linux: simplify Platform_DoubleTime

This commit is contained in:
Alibek Omarov 2019-11-20 16:45:55 +03:00 committed by GitHub
parent 09203dc512
commit 744f75d4a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 9 deletions

View File

@ -21,18 +21,10 @@ GNU General Public License for more details.
#if XASH_TIMER == TIMER_LINUX
double Platform_DoubleTime( void )
{
static longtime_t g_PerformanceFrequency;
static longtime_t g_ClockStart;
longtime_t CurrentTime;
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);
return (double) ts.tv_sec + (double) ts.tv_nsec/1000000000.0;
}