rename Time::ApproximateTo methods to Time::Get
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue, 21 Nov 2006 15:53:32 +0100
changeset 163 2a7e05018eeb
parent 162 5b398ac221c7
child 164 ec0f3aa7f047
rename Time::ApproximateTo methods to Time::Get
samples/main-simulator.cc
src/common/pcap-writer.cc
src/simulator/nstime.h
src/simulator/simulator.cc
src/simulator/time.cc
utils/bench-simulator.cc
--- a/samples/main-simulator.cc	Tue Nov 21 15:50:09 2006 +0100
+++ b/samples/main-simulator.cc	Tue Nov 21 15:53:32 2006 +0100
@@ -17,12 +17,12 @@
 {
   Simulator::Schedule (Seconds (10.0), 
                        &MyModel::DealWithEvent, 
-                       this, Simulator::Now ().ApproximateToSeconds ());
+                       this, Simulator::Now ().GetSeconds ());
 }
 void
 MyModel::DealWithEvent (double value)
 {
-  std::cout << "Member method received event at " << Simulator::Now ().ApproximateToSeconds () 
+  std::cout << "Member method received event at " << Simulator::Now ().GetSeconds () 
             << "s started at " << value << "s" << std::endl;
 }
 
@@ -30,7 +30,7 @@
 random_function (MyModel *model)
 {
   std::cout << "random function received event at " << 
-      Simulator::Now ().ApproximateToSeconds () << "s" << std::endl;
+      Simulator::Now ().GetSeconds () << "s" << std::endl;
   model->Start ();
 }
 
--- a/src/common/pcap-writer.cc	Tue Nov 21 15:50:09 2006 +0100
+++ b/src/common/pcap-writer.cc	Tue Nov 21 15:53:32 2006 +0100
@@ -69,7 +69,7 @@
 {
   if (m_writer != 0) 
     {
-      uint64_t current = Simulator::Now ().ApproximateToMicroSeconds ();
+      uint64_t current = Simulator::Now ().GetMicroSeconds ();
       uint64_t s = current / 1000000;
       uint64_t us = current % 1000000;
       Write32 (s & 0xffffffff);
--- a/src/simulator/nstime.h	Tue Nov 21 15:50:09 2006 +0100
+++ b/src/simulator/nstime.h	Tue Nov 21 15:53:32 2006 +0100
@@ -307,22 +307,22 @@
    * \returns an approximation in seconds of the time stored in this
    *          instance.
    */
-  double ApproximateToSeconds (void) const;
+  double GetSeconds (void) const;
   /**
    * \returns an approximation in milliseconds of the time stored in this
    *          instance.
    */
-  int32_t ApproximateToMilliSeconds (void) const;
+  int32_t GetMilliSeconds (void) const;
   /**
    * \returns an approximation in microseconds of the time stored in this
    *          instance.
    */
-  int64_t ApproximateToMicroSeconds (void) const;
+  int64_t GetMicroSeconds (void) const;
   /**
    * \returns an approximation in nanoseconds of the time stored in this
    *          instance.
    */
-  int64_t ApproximateToNanoSeconds (void) const;
+  int64_t GetNanoSeconds (void) const;
 };
 
 /**
--- a/src/simulator/simulator.cc	Tue Nov 21 15:50:09 2006 +0100
+++ b/src/simulator/simulator.cc	Tue Nov 21 15:53:32 2006 +0100
@@ -177,19 +177,19 @@
 SimulatorPrivate::StopAt (Time const &at)
 {
   assert (at.IsPositive ());
-  m_stopAt = at.ApproximateToNanoSeconds ();
+  m_stopAt = at.GetNanoSeconds ();
 }
 EventId
 SimulatorPrivate::Schedule (Time const &time, EventImpl *event)
 {
   assert (time.IsPositive ());
   assert (time >= NanoSeconds (m_currentNs));
-  uint64_t ns = (uint64_t) time.ApproximateToNanoSeconds ();
+  uint64_t ns = (uint64_t) time.GetNanoSeconds ();
   Scheduler::EventKey key = {ns, m_uid};
   if (m_logEnable) 
     {
       m_log << "i "<<m_currentUid<<" "<<m_currentNs<<" "
-            <<m_uid<<" "<<time.ApproximateToNanoSeconds () << std::endl;
+            <<m_uid<<" "<<time.GetSeconds () << std::endl;
     }
   m_uid++;
   return m_events->Insert (event, key);
@@ -213,7 +213,7 @@
   m_destroy.push_back (std::make_pair (event, m_uid));  
   if (m_logEnable) 
   {
-    m_log << "id " << m_currentUid << " " << Now ().ApproximateToNanoSeconds () << " "
+    m_log << "id " << m_currentUid << " " << Now ().GetNanoSeconds () << " "
           << m_uid << std::endl;
   }
   m_uid++;
@@ -497,7 +497,7 @@
 uint64_t
 SimulatorTests::NowUs (void)
 {
-  uint64_t ns = Now ().ApproximateToNanoSeconds ();
+  uint64_t ns = Now ().GetNanoSeconds ();
   return ns / 1000;
 }  
 void
--- a/src/simulator/time.cc	Tue Nov 21 15:50:09 2006 +0100
+++ b/src/simulator/time.cc	Tue Nov 21 15:53:32 2006 +0100
@@ -31,28 +31,28 @@
 {}
 
 double 
-Time::ApproximateToSeconds (void) const
+Time::GetSeconds (void) const
 {
   HighPrecision seconds = GetHighPrecision ();
   seconds.Div (HighPrecision (1000000000, 0));
   return seconds.GetDouble ();
 }
 int32_t 
-Time::ApproximateToMilliSeconds (void) const
+Time::GetMilliSeconds (void) const
 {
   HighPrecision ms = GetHighPrecision ();
   ms.Div (HighPrecision (1000000, 0));
   return (int32_t) ms.GetHigh ();
 }
 int64_t 
-Time::ApproximateToMicroSeconds (void) const
+Time::GetMicroSeconds (void) const
 {
   HighPrecision us = GetHighPrecision ();
   us.Div (HighPrecision (1000, 0));
   return us.GetHigh ();
 }
 int64_t 
-Time::ApproximateToNanoSeconds (void) const
+Time::GetNanoSeconds (void) const
 {
   return GetHighPrecision ().GetHigh ();
 }
--- a/utils/bench-simulator.cc	Tue Nov 21 15:50:09 2006 +0100
+++ b/utils/bench-simulator.cc	Tue Nov 21 15:53:32 2006 +0100
@@ -103,7 +103,7 @@
       m_current = m_distribution.begin ();
   }
   if (gDebug) {
-      std::cerr << "event at " << Simulator::Now ().ApproximateToSeconds () << "s" << std::endl;
+      std::cerr << "event at " << Simulator::Now ().GetSeconds () << "s" << std::endl;
   }
   Simulator::Schedule (NanoSeconds (*m_current), &Bench::Cb, this);
   m_current++;