// Stopwatch.h: interface for the CStopwatch class. // ///////////////////////////////////////////////////////////////////// #if !defined(STOPWATCH_H) #define STOPWATCH_H #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include // has class definition of IUnknown class IStopwatch : public IUnknown { public: // Stopwatch specific functions virtual HRESULT __stdcall Start() =0; virtual HRESULT __stdcall ElapsedTime(float *Time) =0; }; class CStopwatch : public IStopwatch { public: CStopwatch(); virtual ~CStopwatch(); private: // Reference counting long m_nReferenceCount; // The frequency of the counter // returned by QueryPerformanceCounter() LARGE_INTEGER m_nFrequency; // The counter value when the start method was last called. LARGE_INTEGER m_nStartTime; public: // IUnknown methods HRESULT __stdcall QueryInterface( REFIID riid, void **ppvObject); unsigned long __stdcall AddRef(); unsigned long __stdcall Release(); // IStopwatch specific functions HRESULT __stdcall Start(); HRESULT __stdcall ElapsedTime(float *Time); }; #endif // !defined(STOPWATCH_H)