28 lines
478 B
C++
28 lines
478 B
C++
|
|
#include <Windows.h>
|
|
#include <Spectre/System/System.h>
|
|
|
|
static LARGE_INTEGER getFrequency() {
|
|
|
|
LARGE_INTEGER freq;
|
|
::QueryPerformanceFrequency(&freq);
|
|
return freq;
|
|
}
|
|
|
|
unsigned long System::getMilliseconds()
|
|
{
|
|
static LARGE_INTEGER freq = getFrequency();
|
|
|
|
LARGE_INTEGER cnt;
|
|
::QueryPerformanceCounter(&cnt);
|
|
|
|
cnt.QuadPart *= 1000;
|
|
cnt.QuadPart /= freq.QuadPart;
|
|
|
|
return (unsigned long) cnt.QuadPart;
|
|
}
|
|
|
|
void System::sleep(int milliseconds)
|
|
{
|
|
::Sleep(milliseconds);
|
|
}
|