core: avoid implicit Time conversions

This commit is contained in:
Peter Barnes
2020-06-03 18:13:09 +00:00
parent 963d21b656
commit 852a612c33
6 changed files with 12 additions and 16 deletions

View File

@@ -530,7 +530,7 @@ public:
/** Cast to int64x64_t */ /** Cast to int64x64_t */
inline operator int64x64_t () const explicit inline operator int64x64_t () const
{ {
return int64x64_t (m_data); return int64x64_t (m_data);
} }

View File

@@ -609,7 +609,8 @@ Ipv4DeduplicationPerformanceTest::DoRun (void)
for (uint8_t i = 0; i<nodes.GetN (); i++) for (uint8_t i = 0; i<nodes.GetN (); i++)
{ {
Simulator::ScheduleWithContext (m_sockets[i]->GetNode ()->GetId (), Seconds (4+Seconds(jitter->GetValue ())), Simulator::ScheduleWithContext (m_sockets[i]->GetNode ()->GetId (),
Seconds (4+jitter->GetValue ()),
&Ipv4DeduplicationPerformanceTest::DoSendData, this, m_sockets[i], to, i); &Ipv4DeduplicationPerformanceTest::DoSendData, this, m_sockets[i], to, i);
} }

View File

@@ -449,8 +449,8 @@ LrWpanMac::McpsDataRequest (McpsDataRequestParams params, Ptr<Packet> p)
//TODO: check possible incorrect expire time here. //TODO: check possible incorrect expire time here.
expireTime = MicroSeconds (Simulator::Now () + m_macTransactionPersistanceTime * expireTime = Simulator::Now () + m_macTransactionPersistanceTime
unitPeriodSymbols * 1000 * 1000 / m_phy->GetDataOrSymbolRate (false)); * MicroSeconds (unitPeriodSymbols * 1000 * 1000 / m_phy->GetDataOrSymbolRate (false));
indTxQElement->expireTime = expireTime; indTxQElement->expireTime = expireTime;
indTxQElement->txQMsduHandle = params.m_msduHandle; indTxQElement->txQMsduHandle = params.m_msduHandle;
indTxQElement->txQPkt = p; indTxQElement->txQPkt = p;

View File

@@ -432,6 +432,7 @@ public:
/** /**
* implement PLME SetAttribute confirm SAP * implement PLME SetAttribute confirm SAP
* bit rate is in kbit/s. Symbol rate is in ksymbol/s.
* @param isData is true for data rate or false for symbol rate * @param isData is true for data rate or false for symbol rate
* @return the rate value of this PHY * @return the rate value of this PHY
*/ */
@@ -492,7 +493,8 @@ public:
protected: protected:
/** /**
* The data and symbol rates for the different PHY options. * The data and symbol rates for the different PHY options.
* See Table 2 in section 6.1.2 IEEE 802.15.4-2006 * See Table 2 in section 6.1.2 IEEE 802.15.4-2006.
* Bit rate is in kbit/s. Symbol rate is in ksymbol/s.
*/ */
static const LrWpanPhyDataAndSymbolRates dataSymbolRates[7]; static const LrWpanPhyDataAndSymbolRates dataSymbolRates[7];
/** /**

View File

@@ -970,7 +970,7 @@ CoDelQueueDiscBasicMark::Dequeue (Ptr<CoDelQueueDisc> queue, uint32_t modeSize,
"There should be 1 CE threshold exceeded marked packet"); "There should be 1 CE threshold exceeded marked packet");
} }
} }
else if (initialCeThreshMarkCount > 0 && currentTime.GetMicroSeconds () < queue->GetInterval ()) else if (initialCeThreshMarkCount > 0 && currentTime < queue->GetInterval ())
{ {
if (initialCeThreshMarkCount < 2) if (initialCeThreshMarkCount < 2)
{ {

View File

@@ -366,7 +366,7 @@ UanMacRc::ReceiveOkFromPhy (Ptr<Packet> pkt, double sinr, UanTxMode mode)
Time winDelay = ctsg.GetWindowTime (); Time winDelay = ctsg.GetWindowTime ();
if (winDelay > 0) if (winDelay > Time (0))
{ {
m_rtsBlocked = false; m_rtsBlocked = false;
Simulator::Schedule (winDelay, &UanMacRc::BlockRtsing, this); Simulator::Schedule (winDelay, &UanMacRc::BlockRtsing, this);
@@ -481,16 +481,9 @@ UanMacRc::ScheduleData (const UanHeaderRcCts &ctsh, const UanHeaderRcCtsGlobal &
pkt->AddHeader (ch); pkt->AddHeader (ch);
Time eventTime = startDelay + frameDelay; Time eventTime = startDelay + frameDelay;
if (eventTime < 0) if (eventTime < Time (0))
{ {
if (eventTime > -0.001) NS_FATAL_ERROR ("Scheduling error resulted in very negative data transmission time! eventTime = " << eventTime.As (Time::S));
{
eventTime = Time ();
}
else
{
NS_FATAL_ERROR ("Scheduling error resulted in very negative data transmission time! eventTime = " << eventTime.As (Time::S));
}
} }
NS_LOG_DEBUG (Now ().As (Time::S) << NS_LOG_DEBUG (Now ().As (Time::S) <<
" Node " << Mac8Address::ConvertFrom (GetAddress ()) << " Node " << Mac8Address::ConvertFrom (GetAddress ()) <<