digitalmars.D.bugs - std.perf functions unintuitive (windows version)
timer.start() initializes a timer and saves the starting 'tick' and
frequency.
timer.periodCount() returns ending tick - starting tick, but the ending tick
is only initialized when timer.close() is called.
timer.stop() saves ending 'tick'
timer.second()/millisecond()/microsecond() all depend on periodCount() thus
have no meaning untill stop() is called.
My suggestion is :
remove timer.stop()
add timer.remove(), which removes the instance of the timer (gives you back
that few bytes used :D)
make periodCount() like this:
interval_type periodCount()
{
QueryPerformanceCounter(&m_end);
return m_end - m_start;
}
This way timer.second()/millisecond()/microsecond() all make meaning the
whole time ;)
Nov 23 2006
Keeping timer.stop() introduces a new variable ;)
interval_type periodCount()
{
if (!stop) QueryPerformanceCounter(&m_end);
return m_end - m_start;
}
Nov 23 2006








"nobody_" <spam spam.spam>