blob: cdb863e5203692ba3f97ec9e680f5150fcd59b5d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include <stdafx.h>
static double beginTime;
double I_FloatTime( void )
{
static double freq = 0.0;
static __int64 firstCount;
__int64 curCount;
if (freq == 0.0)
{
__int64 perfFreq;
QueryPerformanceFrequency( (LARGE_INTEGER*)&perfFreq );
QueryPerformanceCounter( (LARGE_INTEGER*)&firstCount );
freq = 1.0 / (double)perfFreq;
}
QueryPerformanceCounter ( (LARGE_INTEGER*)&curCount );
curCount -= firstCount;
double time = (double)curCount * freq;
return time;
}
void I_BeginTime( void )
{
beginTime = I_FloatTime();
}
double I_EndTime( void )
{
return ( I_FloatTime() - beginTime );
}
|