本文整理汇总了C++中Timer::GetLength方法的典型用法代码示例。如果您正苦于以下问题:C++ Timer::GetLength方法的具体用法?C++ Timer::GetLength怎么用?C++ Timer::GetLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer::GetLength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleTick
bool TimerManager::HandleTick(Arch::BaseTimer* source)
{
bool needScheduling = false;
if(source != hardwareTimer)
PANIC("Unexpected clock source!");
Timer *t = currentTimers.Head();
while(t != NULL)
{
if(tickLen < t->GetLength() * 1000) //convert miliseconds from timer to microsenconds (*1000)
{
t->SetLength(t->GetLength() - tickLen); //decrement time until timer expires
TIMER_MGR_DEBUG_MSG("Drecemented remaining time of timer to " << dec << (unsigned int)t->GetLength());
t = currentTimers.GetNext(t);
continue;
}
//if we get here, the timer has already expired
//remove current timer, since it is expired
Timer* nextLoopTimer = currentTimers.GetNext(t);
currentTimers.Remove(t);
t->SetLength(0);
bool ret = t->timerExpired();
TIMER_MGR_DEBUG_MSG("A timer expired");
if(!needScheduling)
needScheduling = ret;
t = nextLoopTimer;
}
prepareClock();
#ifdef EN_TIMER_MGR_DEBUG_MSG
if(needScheduling)
TIMER_MGR_DEBUG_MSG("At least one timer requested scheduling");
#endif
return needScheduling;
}