From e075fcd4f3fe76752a560a1c20e4137ac7b9d2af Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Wed, 21 Nov 2007 15:54:34 +0100 Subject: [PATCH] bug 104: add a method to retrive the maximum simulation time. --- src/simulator/simulator.cc | 18 +++++++++++++++++- src/simulator/simulator.h | 8 ++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/simulator/simulator.cc b/src/simulator/simulator.cc index 0277cf7f2..35b774e5e 100644 --- a/src/simulator/simulator.cc +++ b/src/simulator/simulator.cc @@ -70,6 +70,7 @@ public: 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 @@ SimulatorPrivate::IsExpired (const EventId &ev) const } } +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 @@ Time Now (void) return Time (Simulator::Now ()); } -}; // namespace ns3 +Time +Simulator::GetMaximumSimulationTime (void) +{ + return GetPriv ()->GetMaximumSimulationTime (); +} + +} // namespace ns3 #ifdef RUN_SELF_TESTS diff --git a/src/simulator/simulator.h b/src/simulator/simulator.h index 4f55a7687..afd9601a5 100644 --- a/src/simulator/simulator.h +++ b/src/simulator/simulator.h @@ -558,6 +558,14 @@ public: * 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 ();