Timer oder Zeitmessung?
aus dem Cplusplus-Forum (http://www.c-plusplus.de/forum/index.php).Code:class timer { public: // Konstruktoren timer (); // Methoden void start (); long double stop (); inline long double getlast () const; private: // Konstruktoren timer (const timer&); // Operatoren timer& operator = (const timer&); // Variablen LARGE_INTEGER m_Timer; long double m_Measurement; }; timer::timer () : m_Measurement(0) { m_Timer.QuadPart = 0; } void timer::start () { if(!QueryPerformanceCounter(&m_Timer)) throw; } long double timer::stop () { LARGE_INTEGER EndTime; if(!QueryPerformanceCounter(&EndTime)) throw; EndTime.QuadPart -= m_Timer.QuadPart; LARGE_INTEGER Frequency; QueryPerformanceFrequency(&Frequency); m_Measurement = EndTime.QuadPart / static_cast<long double>(Frequency.QuadPart); return(m_Measurement); } long double timer::getlast () const { return(m_Measurement); }
Blackbird







Zitieren

Lesezeichen