Mercurial > LightClone
view LightClone/Source/Clock.cpp @ 70:ffaeccdc105e
Work on screen manager
author | koryspansel |
---|---|
date | Tue, 11 Oct 2011 12:09:04 -0700 |
parents | 7e3a0ae9c016 |
children |
line wrap: on
line source
/* * Clock */ #include "Clock.h" #include <windows.h> #define QueryFrequency(variable) QueryPerformanceFrequency((LARGE_INTEGER*)variable) #define QueryCounter(variable) QueryPerformanceCounter((LARGE_INTEGER*)variable) /* * Clock */ Clock::Clock() { QueryFrequency(&nFrequency); } /* * Reset */ void Clock::Reset() { QueryCounter(&nCurrent); } /* * GetElapsed */ float Clock::GetElapsed(bool bReset) { unsigned __int64 nTicks = 0; QueryCounter(&nTicks); const float fElapsed = (nTicks - nCurrent) / (float)nFrequency; if(bReset) { Reset(); } return fElapsed; }