--- a/src/simulator/timer.cc Thu Oct 04 09:14:16 2007 +0200
+++ b/src/simulator/timer.cc Thu Oct 04 09:22:05 2007 +0200
@@ -57,7 +57,25 @@
{
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)
--- a/src/simulator/timer.h Thu Oct 04 09:14:16 2007 +0200
+++ b/src/simulator/timer.h Thu Oct 04 09:22:05 2007 +0200
@@ -178,6 +178,12 @@
*/
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.
*/