orca/src/platform/win32_clock.c

39 lines
794 B
C
Raw Normal View History

2023-02-03 17:44:28 +00:00
/************************************************************//**
*
* @file: win32_clock.c
* @author: Martin Fouilleul
* @date: 03/02/2023
* @revision:
*
*****************************************************************/
#include<profileapi.h>
#include"typedefs.h"
#include"platform_clock.h"
#ifdef __cplusplus
extern "C" {
#endif
static u64 __performanceCounterFreq = 0;
void mp_clock_init()
{
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
__performanceCounterFreq = freq.QuadPart;
}
f64 mp_get_time(mp_clock_kind clock)
{
LARGE_INTEGER counter;
QueryPerformanceCounter(&counter);
f64 time = __performanceCounterFreq ? (counter.QuadPart / (f64)__performanceCounterFreq) : 0;
return(time);
}
#ifdef __cplusplus
} // extern "C"
#endif