Implementation of time-arithmetic changes introduced in issue !348 (merged).

Used method for printing time with a unit. Generally the changes follow this pattern:

now.GetSeconds () --> now.As (Time::S)
This commit is contained in:
Anna Poon
2020-09-09 20:44:28 +00:00
committed by Peter D. Barnes, Jr
parent 8b722fd644
commit 1b8eb79481
3 changed files with 5 additions and 5 deletions

View File

@@ -46,7 +46,7 @@ static void SinkRx (Ptr<const Packet> p, const Address &ad)
{
// Enable the below line to see the packet contents printed out at the
// receive sink
//std::cout << Simulator::Now().GetSeconds () << " " << *p << std::endl;
//std::cout << Simulator::Now().As (Time::S) << " " << *p << std::endl;
}
int

View File

@@ -217,7 +217,7 @@ CsmaChannel::TransmitEnd ()
retVal = false;
}
NS_LOG_LOGIC ("Schedule event in " << m_delay.GetSeconds () << " sec");
NS_LOG_LOGIC ("Schedule event in " << m_delay.As (Time::S));
NS_LOG_LOGIC ("Receive");

View File

@@ -495,7 +495,7 @@ CsmaNetDevice::TransmitStart (void)
m_backoff.IncrNumRetries ();
Time backoffTime = m_backoff.GetBackoffTime ();
NS_LOG_LOGIC ("Channel busy, backing off for " << backoffTime.GetSeconds () << " sec");
NS_LOG_LOGIC ("Channel busy, backing off for " << backoffTime.As (Time::S));
Simulator::Schedule (backoffTime, &CsmaNetDevice::TransmitStart, this);
}
@@ -523,7 +523,7 @@ CsmaNetDevice::TransmitStart (void)
m_txMachineState = BUSY;
Time tEvent = m_bps.CalculateBytesTxTime (m_currentPkt->GetSize ());
NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << tEvent.GetSeconds () << "sec");
NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << tEvent.As (Time::S));
Simulator::Schedule (tEvent, &CsmaNetDevice::TransmitCompleteEvent, this);
}
}
@@ -601,7 +601,7 @@ CsmaNetDevice::TransmitCompleteEvent (void)
m_phyTxEndTrace (m_currentPkt);
m_currentPkt = 0;
NS_LOG_LOGIC ("Schedule TransmitReadyEvent in " << m_tInterframeGap.GetSeconds () << "sec");
NS_LOG_LOGIC ("Schedule TransmitReadyEvent in " << m_tInterframeGap.As (Time::S));
Simulator::Schedule (m_tInterframeGap, &CsmaNetDevice::TransmitReadyEvent, this);
}