queryPerformanceCounter problem

Started by
1 comment, last by griffenjam 22 years, 8 months ago
I am using QueryPerformanceCounter and am having a strange problem. The counter is only updated when another window has focus. Whats that all about? griffenjam
"The paths of glory lead but to the grave." - Thomas GrayMy Stupid BlogMy Online Photo Gallery
Advertisement
Um, well that''s odd. Here''s the code I use...

  template <typename T>class HPTimer	{	public:		HPTimer();		T Snap(void);	protected:		T m_tClockFreq;		LARGE_INTEGER m_liPrevSnap;	};template <typename T>HPTimer<T>::HPTimer()	{	LARGE_INTEGER liClockFreq;	if(!QueryPerformanceFrequency(&liClockFreq))		//The Query has failed...		_ASSERT(0);		_ASSERT(liClockFreq.QuadPart);		m_tClockFreq = T(liClockFreq.QuadPart);	}template <typename T>T HPTimer<T>::Snap()	{	LARGE_INTEGER liSnap;	QueryPerformanceCounter(&liSnap);		T tElapsed_sec = T(liSnap.QuadPart - m_liPrevSnap.QuadPart) / m_tClockFreq;	m_liPrevSnap = liSnap;		return(tElapsed_sec);	}//Use it like this:HPTimer<float> m_Timer;float fElaspedTime_sec = m_Timer.Snap();  


Magmai Kai Holmlor
- Not For Rent
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Yeah, that''s very similar to what I am doing.
Is there a problem with the counter on Windows 2000?

griffenjam
"The paths of glory lead but to the grave." - Thomas GrayMy Stupid BlogMy Online Photo Gallery

This topic is closed to new replies.

Advertisement