add Timer::GetDelayLeft
This commit is contained in:
@@ -57,7 +57,25 @@ Timer::GetDelay (void) const
|
||||
{
|
||||
return m_delay;
|
||||
}
|
||||
|
||||
Time
|
||||
Timer::GetDelayLeft (void) const
|
||||
{
|
||||
switch (GetState ()) {
|
||||
case Timer::RUNNING:
|
||||
return Simulator::GetDelayLeft (m_event);
|
||||
break;
|
||||
case Timer::EXPIRED:
|
||||
return TimeStep (0);
|
||||
break;
|
||||
case Timer::SUSPENDED:
|
||||
return m_delayLeft;
|
||||
break;
|
||||
default:
|
||||
NS_ASSERT (false);
|
||||
return TimeStep (0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Timer::Cancel (void)
|
||||
|
||||
@@ -177,6 +177,12 @@ public:
|
||||
* \returns the currently-configured delay for the next Schedule.
|
||||
*/
|
||||
Time GetDelay (void) const;
|
||||
/**
|
||||
* \returns the amount of time left until this timer expires.
|
||||
*
|
||||
* This method returns zero if the timer is in EXPIRED state.
|
||||
*/
|
||||
Time GetDelayLeft (void) const;
|
||||
/**
|
||||
* Cancel the currently-running event if there is one. Do nothing
|
||||
* otherwise.
|
||||
|
||||
Reference in New Issue
Block a user