Keeping timer.stop() introduces a new variable ;) interval_type periodCount() { if (!stop) QueryPerformanceCounter(&m_end); return m_end - m_start; }