rename Time::ApproximateTo methods to Time::Get
parent
b4e41a481b
commit
ac043f3e9d
|
@ -17,12 +17,12 @@ MyModel::Start (void)
|
|||
{
|
||||
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 @@ static void
|
|||
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 ();
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ PcapWriter::WritePacket (Packet const packet)
|
|||
{
|
||||
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);
|
||||
|
|
|
@ -307,22 +307,22 @@ public:
|
|||
* \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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -177,19 +177,19 @@ void
|
|||
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 @@ SimulatorPrivate::ScheduleDestroy (EventImpl *event)
|
|||
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 @@ SimulatorTests::~SimulatorTests ()
|
|||
uint64_t
|
||||
SimulatorTests::NowUs (void)
|
||||
{
|
||||
uint64_t ns = Now ().ApproximateToNanoSeconds ();
|
||||
uint64_t ns = Now ().GetNanoSeconds ();
|
||||
return ns / 1000;
|
||||
}
|
||||
void
|
||||
|
|
|
@ -31,28 +31,28 @@ Time::Time (TimeUnit<1> time)
|
|||
{}
|
||||
|
||||
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 ();
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ Bench::Cb (void)
|
|||
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++;
|
||||
|
|
Loading…
Reference in New Issue