2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-28 15:45:46 +03:00

Merge pull request #449 from In-line/patch-6

Refactor Sys_FloatTime in linux
This commit is contained in:
Lev 2017-04-29 15:23:16 +05:00 committed by GitHub
commit adac0d655d

View File

@ -619,15 +619,15 @@ double EXT_FUNC Sys_FloatTime(void)
double Sys_FloatTime(void)
{
static struct timespec start_time;
static bool bInitialized;
static bool bInitialized = false;
struct timespec now;
if ( !bInitialized )
{
bInitialized = 1;
clock_gettime(1, &start_time);
bInitialized = true;
clock_gettime(CLOCK_MONOTONIC, &start_time);
}
clock_gettime(1, &now);
clock_gettime(CLOCK_MONOTONIC, &now);
return (now.tv_sec - start_time.tv_sec) + now.tv_nsec * 0.000000001;
}