bug 104: add a method to retrive the maximum simulation time.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed, 21 Nov 2007 15:54:34 +0100
changeset 1863 50fa1ca3b26c
parent 1862 3627401f90cf
child 1870 67b3d2dea3d5
bug 104: add a method to retrive the maximum simulation time.
src/simulator/simulator.cc
src/simulator/simulator.h
--- a/src/simulator/simulator.cc	Wed Nov 21 14:14:12 2007 +0100
+++ b/src/simulator/simulator.cc	Wed Nov 21 15:54:34 2007 +0100
@@ -70,6 +70,7 @@
   void Run (void);
   Time Now (void) const;
   Time GetDelayLeft (const EventId &id) const;
+  Time GetMaximumSimulationTime (void) const;
 
 private:
   void ProcessOneEvent (void);
@@ -333,6 +334,15 @@
     }
 }
 
+Time 
+SimulatorPrivate::GetMaximumSimulationTime (void) const
+{
+  // XXX: I am fairly certain other compilers use other non-standard
+  // post-fixes to indicate 64 bit constants.
+  return TimeStep (0x7fffffffffffffffLL);
+}
+
+
 
 }; // namespace ns3
 
@@ -504,7 +514,13 @@
   return Time (Simulator::Now ());
 }
 
-}; // namespace ns3
+Time 
+Simulator::GetMaximumSimulationTime (void)
+{
+  return GetPriv ()->GetMaximumSimulationTime ();
+}
+
+} // namespace ns3
 
 
 #ifdef RUN_SELF_TESTS
--- a/src/simulator/simulator.h	Wed Nov 21 14:14:12 2007 +0100
+++ b/src/simulator/simulator.h	Wed Nov 21 15:54:34 2007 +0100
@@ -558,6 +558,14 @@
    *          zero.
    */
   static Time GetDelayLeft (const EventId &id);
+
+  /**
+   * \returns the maximum simulation time at which an event 
+   *          can be scheduled.
+   *
+   * The returned value will always be bigger than or equal to Simulator::Now.
+   */
+  static Time GetMaximumSimulationTime (void);
 private:
   Simulator ();
   ~Simulator ();