We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 23e8812 + 33f4d40 commit 7f0519dCopy full SHA for 7f0519d
programs/timefn.c
@@ -28,18 +28,20 @@
28
UTIL_time_t UTIL_getTime(void)
29
{
30
static LARGE_INTEGER ticksPerSecond;
31
+ static double nsFactor = 1.0;
32
static int init = 0;
33
if (!init) {
34
if (!QueryPerformanceFrequency(&ticksPerSecond)) {
35
perror("timefn::QueryPerformanceFrequency");
36
abort();
37
}
38
+ nsFactor = 1000000000.0 / (double)ticksPerSecond.QuadPart;
39
init = 1;
40
41
{ UTIL_time_t r;
42
LARGE_INTEGER x;
43
QueryPerformanceCounter(&x);
- r.t = (PTime)(x.QuadPart * 1000000000ULL / ticksPerSecond.QuadPart);
44
+ r.t = (PTime)((double)x.QuadPart * nsFactor);
45
return r;
46
47
0 commit comments