diff -r c1bd4ffb5e47 src/devices/wifi/dcf-manager.cc --- a/src/devices/wifi/dcf-manager.cc Tue Sep 29 10:16:17 2009 -0700 +++ b/src/devices/wifi/dcf-manager.cc Wed Sep 30 01:22:41 2009 +0400 @@ -511,6 +511,7 @@ void DcfManager::UpdateBackoff (void) { + long double slotNanoSeconds = m_slotTime.GetNanoSeconds (); uint32_t k = 0; for (States::const_iterator i = m_states.begin (); i != m_states.end (); i++, k++) { @@ -519,8 +520,9 @@ Time backoffStart = GetBackoffStartFor (state); if (backoffStart <= Simulator::Now ()) { - Scalar nSlots = (Simulator::Now () - backoffStart) / m_slotTime; - uint32_t nIntSlots = lrint (nSlots.GetDouble ()); + long double inBackoffNanoSeconds = Simulator::Now ().GetNanoSeconds () - backoffStart.GetNanoSeconds (); + long double nSlots = inBackoffNanoSeconds / slotNanoSeconds; + uint32_t nIntSlots = lrintl (nSlots); uint32_t n = std::min (nIntSlots, state->GetBackoffSlots ()); MY_DEBUG ("dcf " << k << " dec backoff slots=" << n); Time backoffUpdateBound = backoffStart + Scalar (n) * m_slotTime;