--- a/src/contrib/delay-jitter-estimation.cc Wed Aug 25 17:42:52 2010 +0200
+++ b/src/contrib/delay-jitter-estimation.cc Wed Aug 25 21:31:43 2010 +0200
@@ -98,7 +98,7 @@
tag.GetTxTime ();
Time delta = (Simulator::Now () - m_previousRx) - (tag.GetTxTime () - m_previousRxTx);
- m_jitter += (Abs (delta).To () - m_jitter) / 16;
+ m_jitter += (Abs (delta) - m_jitter) / 16;
m_previousRx = Simulator::Now ();
m_previousRxTx = tag.GetTxTime ();
m_delay = Simulator::Now () - tag.GetTxTime ();
--- a/src/contrib/stats/time-data-calculators.cc Wed Aug 25 17:42:52 2010 +0200
+++ b/src/contrib/stats/time-data-calculators.cc Wed Aug 25 21:31:43 2010 +0200
@@ -73,7 +73,7 @@
callback.OutputSingleton(m_context, m_key + "-count", m_count);
if (m_count > 0) {
callback.OutputSingleton(m_context, m_key + "-total", m_total);
- callback.OutputSingleton(m_context, m_key + "-average", m_total.To () / m_count);
+ callback.OutputSingleton(m_context, m_key + "-average", Time (m_total / m_count));
callback.OutputSingleton(m_context, m_key + "-max", m_max);
callback.OutputSingleton(m_context, m_key + "-min", m_min);
}
--- a/src/devices/csma/backoff.cc Wed Aug 25 17:42:52 2010 +0200
+++ b/src/devices/csma/backoff.cc Wed Aug 25 21:31:43 2010 +0200
@@ -46,7 +46,6 @@
Time
Backoff::GetBackoffTime (void)
{
- Time backoff;
uint32_t ceiling;
if ((m_ceiling > 0) &&(m_numBackoffRetries > m_ceiling))
@@ -67,7 +66,7 @@
uint32_t backoffSlots = (uint32_t)m_rng.GetValue(minSlot, maxSlot);
- backoff = backoffSlots * m_slotTime.To ();
+ Time backoff = Time (backoffSlots * m_slotTime);
return backoff;
}
--- a/src/devices/mesh/dot11s/hwmp-protocol.cc Wed Aug 25 17:42:52 2010 +0200
+++ b/src/devices/mesh/dot11s/hwmp-protocol.cc Wed Aug 25 21:31:43 2010 +0200
@@ -963,7 +963,7 @@
if (i == m_preqTimeouts.end ())
{
m_preqTimeouts[dst].preqTimeout = Simulator::Schedule (
- Time (m_dot11MeshHWMPnetDiameterTraversalTime.To () * 2),
+ Time (m_dot11MeshHWMPnetDiameterTraversalTime * 2),
&HwmpProtocol::RetryPathDiscovery, this, dst, 1);
m_preqTimeouts[dst].whenScheduled = Simulator::Now ();
return true;
@@ -1009,7 +1009,7 @@
i->second->RequestDestination (dst, originator_seqno, dst_seqno);
}
m_preqTimeouts[dst].preqTimeout = Simulator::Schedule (
- Time ((2 * (numOfRetry + 1)) * m_dot11MeshHWMPnetDiameterTraversalTime.To ()),
+ Time ((2 * (numOfRetry + 1)) * m_dot11MeshHWMPnetDiameterTraversalTime),
&HwmpProtocol::RetryPathDiscovery, this, dst, numOfRetry);
}
//Proactive PREQ routines:
--- a/src/devices/spectrum/waveform-generator.cc Wed Aug 25 17:42:52 2010 +0200
+++ b/src/devices/spectrum/waveform-generator.cc Wed Aug 25 21:31:43 2010 +0200
@@ -189,7 +189,7 @@
NS_LOG_FUNCTION (this);
Ptr<PacketBurst> pb = Create<PacketBurst> ();
- Time duration = m_period.To () * m_dutyCycle;
+ Time duration = Time (m_period * m_dutyCycle);
NS_LOG_LOGIC ("generating waveform : " << *m_txPowerSpectralDensity);
m_phyTxStartTrace (0);
--- a/src/devices/wifi/mac-low.cc Wed Aug 25 17:42:52 2010 +0200
+++ b/src/devices/wifi/mac-low.cc Wed Aug 25 21:31:43 2010 +0200
@@ -987,7 +987,7 @@
{
txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsMode, WIFI_PREAMBLE_LONG);
txTime += GetCtsDuration (hdr->GetAddr1 (), rtsMode);
- txTime += GetSifs ().To () * 2;
+ txTime += Time (GetSifs () * 2);
}
uint32_t dataSize = GetSize (packet, hdr);
txTime += m_phy->CalculateTxDuration (dataSize, dataMode, WIFI_PREAMBLE_LONG);
@@ -1047,7 +1047,7 @@
cts.SetType (WIFI_MAC_CTL_CTS);
Time navCounterResetCtsMissedDelay =
m_phy->CalculateTxDuration (cts.GetSerializedSize (), txMode, preamble) +
- 2 * GetSifs ().To () + 2 * GetSlotTime ().To ();
+ Time (2 * GetSifs ()) + Time (2 * GetSlotTime ());
m_navCounterResetCtsMissed = Simulator::Schedule (navCounterResetCtsMissedDelay,
&MacLow::NavCounterResetCtsMissed, this,
Simulator::Now ());
--- a/src/devices/wimax/bs-uplink-scheduler-mbqos.cc Wed Aug 25 17:42:52 2010 +0200
+++ b/src/devices/wimax/bs-uplink-scheduler-mbqos.cc Wed Aug 25 21:31:43 2010 +0200
@@ -313,8 +313,8 @@
Time
uInterval =
MilliSeconds ((*(ssRecord->GetServiceFlows (ServiceFlow::SF_TYPE_UGS).begin ()))->GetUnsolicitedGrantInterval ());
-
- int64x64_t frame = ((timestamp - Simulator::Now ()).To () / frame_duration.To ());
+
+ Time frame = Time ((timestamp - Simulator::Now ()) / frame_duration);
if (frame <= 1)
{
@@ -668,8 +668,8 @@
Time deadline = job->GetDeadline ();
Time frame_duration = GetBs ()->GetPhy ()->GetFrameDuration ();
- int64x64_t frame = ((deadline - Simulator::Now ()).To () / frame_duration.To ());
-
+ Time frame = Time ((deadline - Simulator::Now ()) / frame_duration);
+
NS_LOG_DEBUG ("At " << Simulator::Now ().GetSeconds () << " reserved traffic rate: "
<< job->GetServiceFlow ()->GetMinReservedTrafficRate ()
<<" deadline: "<<job->GetDeadline ().GetSeconds () << " frame start: "<<GetBs ()->m_frameStartTime.GetSeconds ()
--- a/src/internet-stack/rtt-estimator.cc Wed Aug 25 17:42:52 2010 +0200
+++ b/src/internet-stack/rtt-estimator.cc Wed Aug 25 21:31:43 2010 +0200
@@ -65,22 +65,22 @@
void
RttEstimator::SetMinRto (Time minRto)
{
- minrto = minRto.To ();
+ minrto = minRto;
}
Time
RttEstimator::GetMinRto (void) const
{
- return minrto;
+ return Time (minrto);
}
void
RttEstimator::SetEstimate (Time estimate)
{
- est = estimate.To ();
+ est = estimate;
}
Time
RttEstimator::GetEstimate (void) const
{
- return est;
+ return Time (est);
}
@@ -226,18 +226,17 @@
void RttMeanDeviation::Measurement (Time m)
{
- int64x64_t sample = m.To ();
if (nSamples)
{ // Not first
- int64x64_t err = sample - est;
+ int64x64_t err = m - est;
est = est + gain * err; // estimated rtt
variance = variance + gain * (Abs (err) - variance); // variance of rtt
}
else
{ // First sample
- est = sample; // Set estimate to current
+ est = m; // Set estimate to current
//variance = sample / 2; // And variance to current / 2
- variance = sample; // try this
+ variance = m; // try this
}
nSamples++;
}
@@ -256,7 +255,7 @@
retval = (est + 4 * variance) * multiplier; // As suggested by Jacobson
}
retval = Max (retval, minrto);
- return retval;
+ return Time (retval);
}
Ptr<RttEstimator> RttMeanDeviation::Copy () const
--- a/src/internet-stack/tcp-socket-impl.cc Wed Aug 25 17:42:52 2010 +0200
+++ b/src/internet-stack/tcp-socket-impl.cc Wed Aug 25 21:31:43 2010 +0200
@@ -1651,7 +1651,7 @@
void TcpSocketImpl::PersistTimeout ()
{
NS_LOG_LOGIC ("PersistTimeout expired at "<<Simulator::Now ().GetSeconds ());
- m_persistTime = 2 * m_persistTime.To ();
+ m_persistTime = Time (2 * m_persistTime);
m_persistTime = std::min(Seconds(60),m_persistTime); //maxes out at 60
//the persist timeout sends exactly one byte probes
//this is explicit in stevens, and kind of in rfc793 p42, rfc1122 sec4.2.2.17
--- a/src/routing/aodv/aodv-routing-protocol.cc Wed Aug 25 17:42:52 2010 +0200
+++ b/src/routing/aodv/aodv-routing-protocol.cc Wed Aug 25 21:31:43 2010 +0200
@@ -99,15 +99,15 @@
ActiveRouteTimeout (Seconds (3)),
NetDiameter (35),
NodeTraversalTime (MilliSeconds (40)),
- NetTraversalTime (2 * NetDiameter * NodeTraversalTime.To ()),
- PathDiscoveryTime ( 2 * NetTraversalTime.To ()),
- MyRouteTimeout (2 * std::max (PathDiscoveryTime, ActiveRouteTimeout).To ()),
+ NetTraversalTime (2 * NetDiameter * NodeTraversalTime),
+ PathDiscoveryTime ( 2 * NetTraversalTime),
+ MyRouteTimeout (2 * std::max (PathDiscoveryTime, ActiveRouteTimeout)),
HelloInterval(Seconds (1)),
AllowedHelloLoss (2),
- DeletePeriod (5 * std::max(ActiveRouteTimeout, HelloInterval).To ()),
+ DeletePeriod (5 * std::max(ActiveRouteTimeout, HelloInterval)),
NextHopWait (NodeTraversalTime + MilliSeconds (10)),
TimeoutBuffer (2),
- BlackListTimeout(RreqRetries * NetTraversalTime.To ()),
+ BlackListTimeout(RreqRetries * NetTraversalTime),
MaxQueueLen (64),
MaxQueueTime (Seconds(30)),
DestinationOnly (false),
@@ -817,7 +817,7 @@
{
m_htimer.Cancel ();
int rng = UniformVariable ().GetInteger (0, 10);
- m_htimer.Schedule (HelloInterval - 0.01 * MilliSeconds (rng).To ());
+ m_htimer.Schedule (HelloInterval - Time (0.01 * MilliSeconds (rng)));
}
}
@@ -837,7 +837,7 @@
m_routingTable.LookupRoute (dst, rt);
rt.IncrementRreqCnt ();
m_routingTable.Update (rt);
- m_addressReqTimer[dst].Schedule (rt.GetRreqCnt () * NetTraversalTime.To ());
+ m_addressReqTimer[dst].Schedule (Time (rt.GetRreqCnt () * NetTraversalTime));
}
void
@@ -971,7 +971,7 @@
Ptr<NetDevice> dev = m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver));
RoutingTableEntry newEntry (/*device=*/dev, /*dst=*/origin, /*validSeno=*/true, /*seqNo=*/rreqHeader.GetOriginSeqno (),
/*iface=*/m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0), /*hops=*/hop,
- /*nextHop*/src, /*timeLife=*/2 * NetTraversalTime.To () - 2 * hop * NodeTraversalTime.To ());
+ /*nextHop*/src, /*timeLife=*/Time (2 * NetTraversalTime - 2 * hop * NodeTraversalTime));
m_routingTable.AddRoute (newEntry);
}
else
@@ -988,7 +988,7 @@
toOrigin.SetOutputDevice (m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver)));
toOrigin.SetInterface (m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0));
toOrigin.SetHop (hop);
- toOrigin.SetLifeTime (std::max (Time (2 * NetTraversalTime.To () - 2 * hop * NodeTraversalTime.To ()), toOrigin.GetLifeTime ()));
+ toOrigin.SetLifeTime (std::max (Time (2 * NetTraversalTime - 2 * hop * NodeTraversalTime), toOrigin.GetLifeTime ()));
m_routingTable.Update (toOrigin);
}
NS_LOG_LOGIC (receiver << " receive RREQ to destination " << rreqHeader.GetDst ());
@@ -1055,7 +1055,7 @@
{
m_htimer.Cancel ();
int rng = UniformVariable().GetInteger (0, 10);
- m_htimer.Schedule (HelloInterval - 0.1 * MilliSeconds(rng).To ());
+ m_htimer.Schedule (Time (HelloInterval - 0.1 * MilliSeconds(rng)));
}
}
@@ -1302,7 +1302,7 @@
}
else
{
- toNeighbor.SetLifeTime (std::max (Time (AllowedHelloLoss * HelloInterval.To ()), toNeighbor.GetLifeTime ()));
+ toNeighbor.SetLifeTime (std::max (Time (AllowedHelloLoss * HelloInterval), toNeighbor.GetLifeTime ()));
toNeighbor.SetSeqNo (rrepHeader.GetDstSeqno ());
toNeighbor.SetValidSeqNo (true);
toNeighbor.SetFlag (VALID);
@@ -1312,7 +1312,7 @@
}
if (EnableHello)
{
- m_nb.Update (rrepHeader.GetDst (), AllowedHelloLoss * HelloInterval.To ());
+ m_nb.Update (rrepHeader.GetDst (), Time (AllowedHelloLoss * HelloInterval));
}
}
@@ -1423,7 +1423,7 @@
SendHello ();
m_htimer.Cancel ();
int rng = UniformVariable().GetInteger (0, 100);
- Time t = 0.01 * MilliSeconds(rng).To ();
+ Time t = Time (0.01 * MilliSeconds(rng));
m_htimer.Schedule (HelloInterval - t);
}
@@ -1457,7 +1457,7 @@
Ptr<Socket> socket = j->first;
Ipv4InterfaceAddress iface = j->second;
RrepHeader helloHeader (/*prefix size=*/0, /*hops=*/0, /*dst=*/iface.GetLocal (), /*dst seqno=*/m_seqNo,
- /*origin=*/iface.GetLocal (),/*lifetime=*/AllowedHelloLoss * HelloInterval.To ());
+ /*origin=*/iface.GetLocal (),/*lifetime=*/Time (AllowedHelloLoss * HelloInterval));
Ptr<Packet> packet = Create<Packet> ();
packet->AddHeader (helloHeader);
TypeHeader tHeader (AODVTYPE_RREP);
--- a/src/routing/aodv/test/aodv-regression.cc Wed Aug 25 17:42:52 2010 +0200
+++ b/src/routing/aodv/test/aodv-regression.cc Wed Aug 25 21:31:43 2010 +0200
@@ -101,7 +101,7 @@
// At m_time / 3 move central node away and see what will happen
Ptr<Node> node = m_nodes->Get (m_size / 2);
Ptr<MobilityModel> mob = node->GetObject<MobilityModel> ();
- Simulator::Schedule (m_time.To () / 3, &MobilityModel::SetPosition, mob, Vector (1e5, 1e5, 1e5));
+ Simulator::Schedule (Time (m_time / 3), &MobilityModel::SetPosition, mob, Vector (1e5, 1e5, 1e5));
Simulator::Stop (m_time);
Simulator::Run ();
--- a/src/routing/olsr/olsr-routing-protocol.cc Wed Aug 25 17:42:52 2010 +0200
+++ b/src/routing/olsr/olsr-routing-protocol.cc Wed Aug 25 21:31:43 2010 +0200
@@ -73,15 +73,15 @@
/********** Holding times **********/
/// Neighbor holding time.
-#define OLSR_NEIGHB_HOLD_TIME (3 * OLSR_REFRESH_INTERVAL.To ())
+#define OLSR_NEIGHB_HOLD_TIME Time (3 * OLSR_REFRESH_INTERVAL)
/// Top holding time.
-#define OLSR_TOP_HOLD_TIME (3 * m_tcInterval.To ())
+#define OLSR_TOP_HOLD_TIME Time (3 * m_tcInterval)
/// Dup holding time.
#define OLSR_DUP_HOLD_TIME Seconds (30)
/// MID holding time.
-#define OLSR_MID_HOLD_TIME (3 * m_midInterval.To ())
+#define OLSR_MID_HOLD_TIME Time (3 * m_midInterval)
/// HNA holding time.
-#define OLSR_HNA_HOLD_TIME (3 * m_hnaInterval.To ())
+#define OLSR_HNA_HOLD_TIME Time (3 * m_hnaInterval)
/********** Link types **********/
--- a/src/simulator/nstime.h Wed Aug 25 17:42:52 2010 +0200
+++ b/src/simulator/nstime.h Wed Aug 25 21:31:43 2010 +0200
@@ -430,17 +430,17 @@
}
return retval;
}
- inline Time (const int64x64_t &value)
+ inline operator int64x64_t () const
+ {
+ return int64x64_t (m_data);
+ }
+ explicit inline Time (const int64x64_t &value)
: m_data (value.GetHigh ())
{}
inline static Time From (const int64x64_t &value)
{
return Time (value);
}
- inline int64x64_t To (void) const
- {
- return int64x64_t (m_data);
- }
private:
struct Information
--- a/src/simulator/time.cc Wed Aug 25 17:42:52 2010 +0200
+++ b/src/simulator/time.cc Wed Aug 25 21:31:43 2010 +0200
@@ -165,7 +165,7 @@
unit = "unreachable";
break;
}
- int64x64_t v = time.To ();
+ int64x64_t v = time;
os << v << unit;
return os;
}