diff --git a/src/core/model/nstime.h b/src/core/model/nstime.h index 5e83b66f7..109d899a5 100644 --- a/src/core/model/nstime.h +++ b/src/core/model/nstime.h @@ -698,8 +698,11 @@ private: friend Time operator - (const Time & lhs, const Time & rhs); friend Time operator * (const Time & lhs, const int64_t & rhs); friend Time operator * (const int64_t & lhs, const Time & rhs); - friend int64_t operator / (const Time & lhs, const Time & rhs); + friend Time operator * (const Time & lhs, const int64x64_t & rhs); + friend Time operator * (const int64x64_t & lhs, const Time & rhs); + friend int64x64_t operator / (const Time & lhs, const Time & rhs); friend Time operator / (const Time & lhs, const int64_t & rhs); + friend Time operator / (const Time & lhs, const int64x64_t & rhs); friend Time & operator += (Time & lhs, const Time & rhs); friend Time & operator -= (Time & lhs, const Time & rhs); /** @} */ @@ -746,6 +749,9 @@ static bool NS_UNUSED_GLOBAL (g_TimeStaticInit) = Time::StaticInit (); /** * \ingroup time + * @{ + */ +/** * \brief Equality operator for Time. * \param [in] lhs The first value * \param [in] rhs The second value @@ -866,6 +872,32 @@ operator * (const int64_t & lhs, const Time & rhs) res.m_data *= lhs; return res; } +/** + * \ingroup time + * \brief Multiplication operator for Time. + * \param [in] lhs The first value + * \param [in] rhs The second value + * \returns the product of the two input values. + */ +inline Time +operator * (const Time & lhs, const int64x64_t & rhs) +{ + int64x64_t res = lhs.m_data; + res *= rhs; + return Time (res); +} +/** + * \ingroup time + * \brief Multiplication operator for Time. + * \param [in] lhs The first value + * \param [in] rhs The second value + * \returns the product of the two input values. + */ +inline Time +operator * (const int64x64_t & lhs, const Time & rhs) +{ + return rhs * lhs; +} /** * \ingroup time * \brief Division operator for Time. @@ -873,11 +905,12 @@ operator * (const int64_t & lhs, const Time & rhs) * \param [in] rhs The second value * \returns the resultof the first input value divided by the second input value. */ -inline int64_t +inline int64x64_t operator / (const Time & lhs, const Time & rhs) { - int64_t res = lhs.m_data / rhs.m_data; - return res; + int64x64_t num = lhs.m_data; + int64x64_t den = rhs.m_data; + return num / den; } /** * \ingroup time @@ -893,6 +926,20 @@ operator / (const Time & lhs, const int64_t & rhs) res.m_data /= rhs; return res; } +/** + * \ingroup time + * \brief Division operator for Time. + * \param [in] lhs The first value + * \param [in] rhs The second value + * \returns the resultof the first input value divided by the second input value. + */ +inline Time +operator / (const Time & lhs, const int64x64_t & rhs) +{ + int64x64_t res = lhs.m_data; + res /= rhs; + return Time (res); +} /** * \ingroup time * \brief Addition operator for Time. @@ -917,7 +964,6 @@ inline Time & operator -= (Time & lhs, const Time & rhs) lhs.m_data -= rhs.m_data; return lhs; } -/**@}*/ inline Time Abs (const Time & time) { @@ -961,6 +1007,8 @@ std::ostream & operator << (std::ostream & os, const Time & time); */ std::istream & operator >> (std::istream & is, Time & time); +/**@}*/ // \ingroup time + /** * \ingroup time * \defgroup timecivil Standard Time Units. diff --git a/src/internet/test/tcp-hybla-test.cc b/src/internet/test/tcp-hybla-test.cc index 996fc742b..76740c5dc 100644 --- a/src/internet/test/tcp-hybla-test.cc +++ b/src/internet/test/tcp-hybla-test.cc @@ -111,7 +111,7 @@ TcpHyblaIncrementTest::DoRun () NS_TEST_ASSERT_MSG_NE (m_rho, 0.0, "Rho never updated by implementation"); - NS_TEST_ASSERT_MSG_EQ_TOL (calcRho, m_rho, MilliSeconds (10), + NS_TEST_ASSERT_MSG_EQ_TOL (calcRho, m_rho, 0.01, "Different rho values between implementation and test"); cong->IncreaseWindow (m_state, 1); diff --git a/src/mpi/model/distributed-simulator-impl.cc b/src/mpi/model/distributed-simulator-impl.cc index bfcab866a..ed842a0e7 100644 --- a/src/mpi/model/distributed-simulator-impl.cc +++ b/src/mpi/model/distributed-simulator-impl.cc @@ -284,7 +284,7 @@ DistributedSimulatorImpl::CalculateLookAhead (void) void DistributedSimulatorImpl::SetMaximumLookAhead (const Time lookAhead) { - if (lookAhead > 0) + if (lookAhead > Time (0)) { NS_LOG_FUNCTION (this << lookAhead); m_lookAhead = lookAhead; diff --git a/src/network/helper/delay-jitter-estimation.cc b/src/network/helper/delay-jitter-estimation.cc index 21448c210..c65ce2020 100644 --- a/src/network/helper/delay-jitter-estimation.cc +++ b/src/network/helper/delay-jitter-estimation.cc @@ -134,7 +134,7 @@ DelayJitterEstimation::RecordRx (Ptr packet) tag.GetTxTime (); Time delta = (Simulator::Now () - m_previousRx) - (tag.GetTxTime () - m_previousRxTx); - m_jitter += (Abs (delta) - m_jitter) / 16; + m_jitter += (Abs (delta) - m_jitter) / (int64x64_t)16; m_previousRx = Simulator::Now (); m_previousRxTx = tag.GetTxTime (); m_delay = Simulator::Now () - tag.GetTxTime (); diff --git a/src/wave/model/default-channel-scheduler.cc b/src/wave/model/default-channel-scheduler.cc index 25bdfc0c3..f44534212 100644 --- a/src/wave/model/default-channel-scheduler.cc +++ b/src/wave/model/default-channel-scheduler.cc @@ -259,7 +259,7 @@ DefaultChannelScheduler::AssignExtendedAccess (uint32_t channelNumber, uint32_t { // if current remain extends cannot fulfill the requirement for extends Time remainTime = Simulator::GetDelayLeft (m_extendEvent); - uint32_t remainExtends = remainTime / m_coordinator->GetSyncInterval (); + uint32_t remainExtends = (remainTime / m_coordinator->GetSyncInterval ()).GetHigh (); if (remainExtends > extends) { return true; diff --git a/src/wifi/model/channel-access-manager.cc b/src/wifi/model/channel-access-manager.cc index 46d766679..1c68fb559 100644 --- a/src/wifi/model/channel-access-manager.cc +++ b/src/wifi/model/channel-access-manager.cc @@ -486,7 +486,7 @@ ChannelAccessManager::UpdateBackoff (void) Time backoffStart = GetBackoffStartFor (state); if (backoffStart <= Simulator::Now ()) { - uint32_t nIntSlots = (Simulator::Now () - backoffStart) / m_slot; + uint32_t nIntSlots = ((Simulator::Now () - backoffStart) / m_slot).GetHigh (); /* * EDCA behaves slightly different to DCA. For EDCA we * decrement once at the slot boundary at the end of AIFS as diff --git a/src/wifi/model/mac-low.cc b/src/wifi/model/mac-low.cc index d00ac9e3b..97a888879 100644 --- a/src/wifi/model/mac-low.cc +++ b/src/wifi/model/mac-low.cc @@ -1462,7 +1462,7 @@ MacLow::ForwardDown (Ptr packet, const WifiMacHeader* hdr, WifiTxV } if (queueSize > 1) { - NS_ASSERT (remainingAmpduDuration > 0); + NS_ASSERT (remainingAmpduDuration > Time (0)); delay = delay + mpduDuration; } diff --git a/src/wifi/model/minstrel-wifi-manager.cc b/src/wifi/model/minstrel-wifi-manager.cc index 4de961fc5..05b8b20a6 100644 --- a/src/wifi/model/minstrel-wifi-manager.cc +++ b/src/wifi/model/minstrel-wifi-manager.cc @@ -965,7 +965,7 @@ MinstrelWifiManager::CalculateTimeUnicastPacket (Time dataTransmissionTime, uint tt += dataTransmissionTime + GetMac ()->GetAckTimeout (); //Add average back off (half the current contention window) - tt += NanoSeconds ((cw / 2) * GetMac ()->GetSlot ()); + tt += (cw / 2.0) * GetMac ()->GetSlot (); //Update contention window cw = std::min (cwMax, (cw + 1) * 2); diff --git a/src/wimax/model/bs-uplink-scheduler-mbqos.cc b/src/wimax/model/bs-uplink-scheduler-mbqos.cc index 161af1f83..a91a18005 100644 --- a/src/wimax/model/bs-uplink-scheduler-mbqos.cc +++ b/src/wimax/model/bs-uplink-scheduler-mbqos.cc @@ -312,7 +312,7 @@ UplinkSchedulerMBQoS::Schedule (void) (*(ssRecord->GetServiceFlows (ServiceFlow::SF_TYPE_UGS).begin ()))->GetRecord ()->GetLastGrantTime () + MilliSeconds ((*(ssRecord->GetServiceFlows (ServiceFlow::SF_TYPE_UGS).begin ()))->GetUnsolicitedGrantInterval ()); - int64_t frame = (timestamp - Simulator::Now ()) / frame_duration; + int64_t frame = ((timestamp - Simulator::Now ()) / frame_duration).GetHigh (); if (frame <= 1) { @@ -663,7 +663,7 @@ UplinkSchedulerMBQoS::CheckDeadline (uint32_t &availableSymbols) Time deadline = job->GetDeadline (); Time frame_duration = GetBs ()->GetPhy ()->GetFrameDuration (); - int64_t frame = (deadline - Simulator::Now ()) / frame_duration; + int64_t frame = ((deadline - Simulator::Now ()) / frame_duration).GetHigh (); NS_LOG_DEBUG ("At " << Simulator::Now ().GetSeconds () << " reserved traffic rate: " << job->GetServiceFlow ()->GetMinReservedTrafficRate ()