mirror of
https://github.com/rehlds/ReHLDS.git
synced 2025-08-11 00:59:36 +03:00
Refactor Sys_FloatTime in linux
This commit is contained in:
parent
f812b2ea2e
commit
0698bcc899
1 changed files with 4 additions and 4 deletions
|
@ -619,15 +619,15 @@ double EXT_FUNC Sys_FloatTime(void)
|
||||||
double Sys_FloatTime(void)
|
double Sys_FloatTime(void)
|
||||||
{
|
{
|
||||||
static struct timespec start_time;
|
static struct timespec start_time;
|
||||||
static bool bInitialized;
|
static bool bInitialized = false;
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
|
|
||||||
if ( !bInitialized )
|
if ( !bInitialized )
|
||||||
{
|
{
|
||||||
bInitialized = 1;
|
bInitialized = true;
|
||||||
clock_gettime(1, &start_time);
|
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;
|
return (now.tv_sec - start_time.tv_sec) + now.tv_nsec * 0.000000001;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue