mirror of
https://github.com/facebook/zstd
synced 2026-08-22 22:32:07 -04:00
parent
6775af5b2e
commit
33f4d40d1e
1 changed files with 3 additions and 1 deletions
|
|
@ -28,18 +28,20 @@
|
|||
UTIL_time_t UTIL_getTime(void)
|
||||
{
|
||||
static LARGE_INTEGER ticksPerSecond;
|
||||
static double nsFactor = 1.0;
|
||||
static int init = 0;
|
||||
if (!init) {
|
||||
if (!QueryPerformanceFrequency(&ticksPerSecond)) {
|
||||
perror("timefn::QueryPerformanceFrequency");
|
||||
abort();
|
||||
}
|
||||
nsFactor = 1000000000.0 / (double)ticksPerSecond.QuadPart;
|
||||
init = 1;
|
||||
}
|
||||
{ UTIL_time_t r;
|
||||
LARGE_INTEGER x;
|
||||
QueryPerformanceCounter(&x);
|
||||
r.t = (PTime)(x.QuadPart * 1000000000ULL / ticksPerSecond.QuadPart);
|
||||
r.t = (PTime)((double)x.QuadPart * nsFactor);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue