作者crazytea (............)
看板C_and_CPP
标题[问题] 1ms的码表 (累加器)
时间Fri Apr 24 22:22:09 2009
想要写的功能是:
能在萤幕上显示 一个秒数, 以 1ms +1 的速度显示 ,
的马表
long times;
do{
timeBeginPeriod(1);
DWORD TempTime, StartTime, DelayTime;
DelayTime = 1;
StartTime = timeGetTime();
do {
TempTime = timeGetTime();
if (TempTime < StartTime)
StartTime = TempTime;
} while( (TempTime - StartTime) < DelayTime );
times++ ;
timeEndPeriod(1);
Ogre::DisplayString sec = Ogre::StringConverter::toString(times);
timer->setCaption(sec) ;
//上两行是输出 不用理
} while ( times > 2000 );
但是好像还是得不到我要的结果.. QQ
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 192.192.154.43
1F:推 VictorTom:如果你的程式可以就busy在那个回圈里的话, 也许可以试试 04/24 22:52
2F:→ VictorTom:QueryPerformanceCounter()与其相关的函数....:) 04/24 22:52
4F:→ ksmrt0123:肉眼看不出1ms的变化 故只要到100ms就够了 後两位用乱数 04/25 01:57