View | Details | Raw Unified | Return to bug 445
Collapse All | Expand All

(-)a/bindings/python/apidefs/gcc-ILP32/ns3_module_simulator.py (-11 / +11 lines)
 Lines 12-18    Link Here 
12
    ## nstime.h: ns3::TimeUnit<-1> [class]
12
    ## nstime.h: ns3::TimeUnit<-1> [class]
13
    module.add_class('TimeInvert')
13
    module.add_class('TimeInvert')
14
    ## nstime.h: ns3::TimeUnit<0> [class]
14
    ## nstime.h: ns3::TimeUnit<0> [class]
15
    module.add_class('Scalar')
15
    module.add_class('TimeScaleFactor')
16
    ## nstime.h: ns3::TimeUnit<1> [class]
16
    ## nstime.h: ns3::TimeUnit<1> [class]
17
    module.add_class('Time')
17
    module.add_class('Time')
18
    ## nstime.h: ns3::TimeUnit<2> [class]
18
    ## nstime.h: ns3::TimeUnit<2> [class]
 Lines 63-77    Link Here 
63
    module.add_class('TimeChecker', parent=root_module['ns3::AttributeChecker'])
63
    module.add_class('TimeChecker', parent=root_module['ns3::AttributeChecker'])
64
    ## nstime.h: ns3::TimeValue [class]
64
    ## nstime.h: ns3::TimeValue [class]
65
    module.add_class('TimeValue', parent=root_module['ns3::AttributeValue'])
65
    module.add_class('TimeValue', parent=root_module['ns3::AttributeValue'])
66
    typehandlers.add_type_alias('ns3::TimeUnit< 0 >', 'ns3::TimeScaleFactor')
67
    typehandlers.add_type_alias('ns3::TimeUnit< 0 >*', 'ns3::TimeScaleFactor*')
68
    typehandlers.add_type_alias('ns3::TimeUnit< 0 >&', 'ns3::TimeScaleFactor&')
66
    typehandlers.add_type_alias('ns3::TimeUnit< 2 >', 'ns3::TimeSquare')
69
    typehandlers.add_type_alias('ns3::TimeUnit< 2 >', 'ns3::TimeSquare')
67
    typehandlers.add_type_alias('ns3::TimeUnit< 2 >*', 'ns3::TimeSquare*')
70
    typehandlers.add_type_alias('ns3::TimeUnit< 2 >*', 'ns3::TimeSquare*')
68
    typehandlers.add_type_alias('ns3::TimeUnit< 2 >&', 'ns3::TimeSquare&')
71
    typehandlers.add_type_alias('ns3::TimeUnit< 2 >&', 'ns3::TimeSquare&')
69
    typehandlers.add_type_alias('ns3::TimeUnit< - 1 >', 'ns3::TimeInvert')
72
    typehandlers.add_type_alias('ns3::TimeUnit< - 1 >', 'ns3::TimeInvert')
70
    typehandlers.add_type_alias('ns3::TimeUnit< - 1 >*', 'ns3::TimeInvert*')
73
    typehandlers.add_type_alias('ns3::TimeUnit< - 1 >*', 'ns3::TimeInvert*')
71
    typehandlers.add_type_alias('ns3::TimeUnit< - 1 >&', 'ns3::TimeInvert&')
74
    typehandlers.add_type_alias('ns3::TimeUnit< - 1 >&', 'ns3::TimeInvert&')
72
    typehandlers.add_type_alias('ns3::TimeUnit< 0 >', 'ns3::Scalar')
73
    typehandlers.add_type_alias('ns3::TimeUnit< 0 >*', 'ns3::Scalar*')
74
    typehandlers.add_type_alias('ns3::TimeUnit< 0 >&', 'ns3::Scalar&')
75
    typehandlers.add_type_alias('ns3::TimeUnit< 1 >', 'ns3::Time')
75
    typehandlers.add_type_alias('ns3::TimeUnit< 1 >', 'ns3::Time')
76
    typehandlers.add_type_alias('ns3::TimeUnit< 1 >*', 'ns3::Time*')
76
    typehandlers.add_type_alias('ns3::TimeUnit< 1 >*', 'ns3::Time*')
77
    typehandlers.add_type_alias('ns3::TimeUnit< 1 >&', 'ns3::Time&')
77
    typehandlers.add_type_alias('ns3::TimeUnit< 1 >&', 'ns3::Time&')
 Lines 173-179    Link Here 
173
    register_Ns3HighPrecision_methods(root_module, root_module['ns3::HighPrecision'])
173
    register_Ns3HighPrecision_methods(root_module, root_module['ns3::HighPrecision'])
174
    register_Ns3Simulator_methods(root_module, root_module['ns3::Simulator'])
174
    register_Ns3Simulator_methods(root_module, root_module['ns3::Simulator'])
175
    register_Ns3TimeInvert_methods(root_module, root_module['ns3::TimeInvert'])
175
    register_Ns3TimeInvert_methods(root_module, root_module['ns3::TimeInvert'])
176
    register_Ns3Scalar_methods(root_module, root_module['ns3::Scalar'])
176
    register_Ns3TimeScaleFactor_methods(root_module, root_module['ns3::TimeScaleFactor'])
177
    register_Ns3Time_methods(root_module, root_module['ns3::Time'])
177
    register_Ns3Time_methods(root_module, root_module['ns3::Time'])
178
    register_Ns3TimeSquare_methods(root_module, root_module['ns3::TimeSquare'])
178
    register_Ns3TimeSquare_methods(root_module, root_module['ns3::TimeSquare'])
179
    register_Ns3Timer_methods(root_module, root_module['ns3::Timer'])
179
    register_Ns3Timer_methods(root_module, root_module['ns3::Timer'])
 Lines 422-432    Link Here 
422
                   [])
422
                   [])
423
    return
423
    return
424
424
425
def register_Ns3Scalar_methods(root_module, cls):
425
def register_Ns3TimeScaleFactor_methods(root_module, cls):
426
    cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Scalar'], param('ns3::TimeUnit< 1 > const &', 'right'))
426
    cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::TimeScaleFactor'], param('ns3::TimeUnit< 1 > const &', 'right'))
427
    cls.add_binary_numeric_operator('/', root_module['ns3::TimeInvert'], root_module['ns3::Scalar'], param('ns3::TimeUnit< 1 > const &', 'right'))
427
    cls.add_binary_numeric_operator('/', root_module['ns3::TimeInvert'], root_module['ns3::TimeScaleFactor'], param('ns3::TimeUnit< 1 > const &', 'right'))
428
    ## nstime.h: ns3::TimeUnit<0>::TimeUnit(double scalar) [constructor]
428
    ## nstime.h: ns3::TimeUnit<0>::TimeUnit(double timescale) [constructor]
429
    cls.add_constructor([param('double', 'scalar')])
429
    cls.add_constructor([param('double', 'timescale')])
430
    ## nstime.h: ns3::TimeUnit<0>::TimeUnit() [constructor]
430
    ## nstime.h: ns3::TimeUnit<0>::TimeUnit() [constructor]
431
    cls.add_constructor([])
431
    cls.add_constructor([])
432
    ## nstime.h: ns3::TimeUnit<0>::TimeUnit(ns3::TimeUnit<0> const & o) [copy constructor]
432
    ## nstime.h: ns3::TimeUnit<0>::TimeUnit(ns3::TimeUnit<0> const & o) [copy constructor]
 Lines 480-486    Link Here 
480
    cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::TimeUnit< 1 > const &', 'right'))
480
    cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::TimeUnit< 1 > const &', 'right'))
481
    cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::TimeUnit< 1 > const &', 'right'))
481
    cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::TimeUnit< 1 > const &', 'right'))
482
    cls.add_binary_numeric_operator('/', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::TimeUnit< 0 > const &', 'right'))
482
    cls.add_binary_numeric_operator('/', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::TimeUnit< 0 > const &', 'right'))
483
    cls.add_binary_numeric_operator('/', root_module['ns3::Scalar'], root_module['ns3::Time'], param('ns3::TimeUnit< 1 > const &', 'right'))
483
    cls.add_binary_numeric_operator('/', root_module['ns3::TimeScaleFactor'], root_module['ns3::Time'], param('ns3::TimeUnit< 1 > const &', 'right'))
484
    cls.add_binary_comparison_operator('<')
484
    cls.add_binary_comparison_operator('<')
485
    cls.add_binary_comparison_operator('>')
485
    cls.add_binary_comparison_operator('>')
486
    cls.add_output_stream_operator()
486
    cls.add_output_stream_operator()
(-)a/bindings/python/apidefs/gcc-LP64/ns3_module_simulator.py (-11 / +11 lines)
 Lines 12-18    Link Here 
12
    ## nstime.h: ns3::TimeUnit<-1> [class]
12
    ## nstime.h: ns3::TimeUnit<-1> [class]
13
    module.add_class('TimeInvert')
13
    module.add_class('TimeInvert')
14
    ## nstime.h: ns3::TimeUnit<0> [class]
14
    ## nstime.h: ns3::TimeUnit<0> [class]
15
    module.add_class('Scalar')
15
    module.add_class('TimeScaleFactor')
16
    ## nstime.h: ns3::TimeUnit<1> [class]
16
    ## nstime.h: ns3::TimeUnit<1> [class]
17
    module.add_class('Time')
17
    module.add_class('Time')
18
    ## nstime.h: ns3::TimeUnit<2> [class]
18
    ## nstime.h: ns3::TimeUnit<2> [class]
 Lines 63-77    Link Here 
63
    module.add_class('TimeChecker', parent=root_module['ns3::AttributeChecker'])
63
    module.add_class('TimeChecker', parent=root_module['ns3::AttributeChecker'])
64
    ## nstime.h: ns3::TimeValue [class]
64
    ## nstime.h: ns3::TimeValue [class]
65
    module.add_class('TimeValue', parent=root_module['ns3::AttributeValue'])
65
    module.add_class('TimeValue', parent=root_module['ns3::AttributeValue'])
66
    typehandlers.add_type_alias('ns3::TimeUnit< 0 >', 'ns3::TimeScaleFactor')
67
    typehandlers.add_type_alias('ns3::TimeUnit< 0 >*', 'ns3::TimeScaleFactor*')
68
    typehandlers.add_type_alias('ns3::TimeUnit< 0 >&', 'ns3::TimeScaleFactor&')
66
    typehandlers.add_type_alias('ns3::TimeUnit< 2 >', 'ns3::TimeSquare')
69
    typehandlers.add_type_alias('ns3::TimeUnit< 2 >', 'ns3::TimeSquare')
67
    typehandlers.add_type_alias('ns3::TimeUnit< 2 >*', 'ns3::TimeSquare*')
70
    typehandlers.add_type_alias('ns3::TimeUnit< 2 >*', 'ns3::TimeSquare*')
68
    typehandlers.add_type_alias('ns3::TimeUnit< 2 >&', 'ns3::TimeSquare&')
71
    typehandlers.add_type_alias('ns3::TimeUnit< 2 >&', 'ns3::TimeSquare&')
69
    typehandlers.add_type_alias('ns3::TimeUnit< - 1 >', 'ns3::TimeInvert')
72
    typehandlers.add_type_alias('ns3::TimeUnit< - 1 >', 'ns3::TimeInvert')
70
    typehandlers.add_type_alias('ns3::TimeUnit< - 1 >*', 'ns3::TimeInvert*')
73
    typehandlers.add_type_alias('ns3::TimeUnit< - 1 >*', 'ns3::TimeInvert*')
71
    typehandlers.add_type_alias('ns3::TimeUnit< - 1 >&', 'ns3::TimeInvert&')
74
    typehandlers.add_type_alias('ns3::TimeUnit< - 1 >&', 'ns3::TimeInvert&')
72
    typehandlers.add_type_alias('ns3::TimeUnit< 0 >', 'ns3::Scalar')
73
    typehandlers.add_type_alias('ns3::TimeUnit< 0 >*', 'ns3::Scalar*')
74
    typehandlers.add_type_alias('ns3::TimeUnit< 0 >&', 'ns3::Scalar&')
75
    typehandlers.add_type_alias('ns3::TimeUnit< 1 >', 'ns3::Time')
75
    typehandlers.add_type_alias('ns3::TimeUnit< 1 >', 'ns3::Time')
76
    typehandlers.add_type_alias('ns3::TimeUnit< 1 >*', 'ns3::Time*')
76
    typehandlers.add_type_alias('ns3::TimeUnit< 1 >*', 'ns3::Time*')
77
    typehandlers.add_type_alias('ns3::TimeUnit< 1 >&', 'ns3::Time&')
77
    typehandlers.add_type_alias('ns3::TimeUnit< 1 >&', 'ns3::Time&')
 Lines 173-179    Link Here 
173
    register_Ns3HighPrecision_methods(root_module, root_module['ns3::HighPrecision'])
173
    register_Ns3HighPrecision_methods(root_module, root_module['ns3::HighPrecision'])
174
    register_Ns3Simulator_methods(root_module, root_module['ns3::Simulator'])
174
    register_Ns3Simulator_methods(root_module, root_module['ns3::Simulator'])
175
    register_Ns3TimeInvert_methods(root_module, root_module['ns3::TimeInvert'])
175
    register_Ns3TimeInvert_methods(root_module, root_module['ns3::TimeInvert'])
176
    register_Ns3Scalar_methods(root_module, root_module['ns3::Scalar'])
176
    register_Ns3TimeScaleFactor_methods(root_module, root_module['ns3::TimeScaleFactor'])
177
    register_Ns3Time_methods(root_module, root_module['ns3::Time'])
177
    register_Ns3Time_methods(root_module, root_module['ns3::Time'])
178
    register_Ns3TimeSquare_methods(root_module, root_module['ns3::TimeSquare'])
178
    register_Ns3TimeSquare_methods(root_module, root_module['ns3::TimeSquare'])
179
    register_Ns3Timer_methods(root_module, root_module['ns3::Timer'])
179
    register_Ns3Timer_methods(root_module, root_module['ns3::Timer'])
 Lines 422-432    Link Here 
422
                   [])
422
                   [])
423
    return
423
    return
424
424
425
def register_Ns3Scalar_methods(root_module, cls):
425
def register_Ns3TimeScaleFactor_methods(root_module, cls):
426
    cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Scalar'], param('ns3::TimeUnit< 1 > const &', 'right'))
426
    cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::TimeScaleFactor'], param('ns3::TimeUnit< 1 > const &', 'right'))
427
    cls.add_binary_numeric_operator('/', root_module['ns3::TimeInvert'], root_module['ns3::Scalar'], param('ns3::TimeUnit< 1 > const &', 'right'))
427
    cls.add_binary_numeric_operator('/', root_module['ns3::TimeInvert'], root_module['ns3::TimeScaleFactor'], param('ns3::TimeUnit< 1 > const &', 'right'))
428
    ## nstime.h: ns3::TimeUnit<0>::TimeUnit(double scalar) [constructor]
428
    ## nstime.h: ns3::TimeUnit<0>::TimeUnit(double timescale)) [constructor]
429
    cls.add_constructor([param('double', 'scalar')])
429
    cls.add_constructor([param('double', 'timescale')])
430
    ## nstime.h: ns3::TimeUnit<0>::TimeUnit() [constructor]
430
    ## nstime.h: ns3::TimeUnit<0>::TimeUnit() [constructor]
431
    cls.add_constructor([])
431
    cls.add_constructor([])
432
    ## nstime.h: ns3::TimeUnit<0>::TimeUnit(ns3::TimeUnit<0> const & o) [copy constructor]
432
    ## nstime.h: ns3::TimeUnit<0>::TimeUnit(ns3::TimeUnit<0> const & o) [copy constructor]
 Lines 480-486    Link Here 
480
    cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::TimeUnit< 1 > const &', 'right'))
480
    cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::TimeUnit< 1 > const &', 'right'))
481
    cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::TimeUnit< 1 > const &', 'right'))
481
    cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::TimeUnit< 1 > const &', 'right'))
482
    cls.add_binary_numeric_operator('/', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::TimeUnit< 0 > const &', 'right'))
482
    cls.add_binary_numeric_operator('/', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::TimeUnit< 0 > const &', 'right'))
483
    cls.add_binary_numeric_operator('/', root_module['ns3::Scalar'], root_module['ns3::Time'], param('ns3::TimeUnit< 1 > const &', 'right'))
483
    cls.add_binary_numeric_operator('/', root_module['ns3::TimeScaleFactor'], root_module['ns3::Time'], param('ns3::TimeUnit< 1 > const &', 'right'))
484
    cls.add_binary_comparison_operator('<')
484
    cls.add_binary_comparison_operator('<')
485
    cls.add_binary_comparison_operator('>')
485
    cls.add_binary_comparison_operator('>')
486
    cls.add_output_stream_operator()
486
    cls.add_output_stream_operator()
(-)a/bindings/python/wscript (-4 / +4 lines)
 Lines 314-323    Link Here 
314
   t1 = t2 - t3;
314
   t1 = t2 - t3;
315
   TimeSquare tsq = t2*t3;
315
   TimeSquare tsq = t2*t3;
316
   Time tsqdiv = tsq/Seconds(1);
316
   Time tsqdiv = tsq/Seconds(1);
317
   Scalar scal = t2/t3;
317
   TimeScaleFactor dim = t2/t3;
318
   TimeInvert inv = scal/t3;
318
   TimeInvert inv = dim/t3;
319
   t1 = scal*t1;
319
   t1 = dim*t1;
320
   t1 = t1/scal;
320
   t1 = t1/dim;
321
   t1 < t2;
321
   t1 < t2;
322
   t1 <= t2;
322
   t1 <= t2;
323
   t1 == t2;
323
   t1 == t2;
(-)a/src/applications/onoff/onoff-application.cc (-1 / +1 lines)
 Lines 166-172    Link Here 
166
    { // Cancel the pending send packet event
166
    { // Cancel the pending send packet event
167
      // Calculate residual bits since last packet sent
167
      // Calculate residual bits since last packet sent
168
      Time delta(Simulator::Now() - m_lastStartTime);
168
      Time delta(Simulator::Now() - m_lastStartTime);
169
      Scalar bits = delta * Scalar (m_cbrRate.GetBitRate ()) / Seconds (1.0);
169
      TimeScaleFactor bits = delta * TimeScaleFactor (m_cbrRate.GetBitRate ()) / Seconds (1.0);
170
      m_residualBits += (uint32_t)bits.GetDouble ();
170
      m_residualBits += (uint32_t)bits.GetDouble ();
171
    }
171
    }
172
  Simulator::Cancel(m_sendEvent);
172
  Simulator::Cancel(m_sendEvent);
(-)a/src/contrib/delay-jitter-estimation.cc (-1 / +1 lines)
 Lines 98-104    Link Here 
98
  tag.GetTxTime ();
98
  tag.GetTxTime ();
99
99
100
  Time delta = (Simulator::Now () - m_previousRx) - (tag.GetTxTime () - m_previousRxTx);
100
  Time delta = (Simulator::Now () - m_previousRx) - (tag.GetTxTime () - m_previousRxTx);
101
  m_jitter += (Abs (delta) - m_jitter ) / Scalar (16.0);
101
  m_jitter += (Abs (delta) - m_jitter ) / TimeScaleFactor (16.0);
102
  m_previousRx = Simulator::Now ();
102
  m_previousRx = Simulator::Now ();
103
  m_previousRxTx = tag.GetTxTime ();
103
  m_previousRxTx = tag.GetTxTime ();
104
  m_delay = Simulator::Now () - tag.GetTxTime ();
104
  m_delay = Simulator::Now () - tag.GetTxTime ();
(-)a/src/contrib/flow-monitor/flow-probe.h (-1 / +1 lines)
 Lines 57-63    Link Here 
57
    std::vector<uint32_t> packetsDropped;
57
    std::vector<uint32_t> packetsDropped;
58
    /// bytesDropped[reasonCode] => number of dropped bytes
58
    /// bytesDropped[reasonCode] => number of dropped bytes
59
    std::vector<uint64_t> bytesDropped;
59
    std::vector<uint64_t> bytesDropped;
60
    /// divide by 'Scalar (packets)' to get the average delay from the
60
    /// divide by 'TimeScaleFactor (packets)' to get the average delay from the
61
    /// first (entry) probe up to this one (partial delay)
61
    /// first (entry) probe up to this one (partial delay)
62
    Time delayFromFirstProbeSum;
62
    Time delayFromFirstProbeSum;
63
    /// Number of bytes seen of this flow
63
    /// Number of bytes seen of this flow
(-)a/src/contrib/stats/time-data-calculators.cc (-1 / +1 lines)
 Lines 73-79    Link Here 
73
  callback.OutputSingleton(m_context, m_key + "-count", m_count);
73
  callback.OutputSingleton(m_context, m_key + "-count", m_count);
74
  if (m_count > 0) {
74
  if (m_count > 0) {
75
    callback.OutputSingleton(m_context, m_key + "-total", m_total);
75
    callback.OutputSingleton(m_context, m_key + "-total", m_total);
76
    callback.OutputSingleton(m_context, m_key + "-average", m_total/Scalar(m_count));
76
    callback.OutputSingleton(m_context, m_key + "-average", m_total/TimeScaleFactor(m_count));
77
    callback.OutputSingleton(m_context, m_key + "-max", m_max);
77
    callback.OutputSingleton(m_context, m_key + "-max", m_max);
78
    callback.OutputSingleton(m_context, m_key + "-min", m_min);
78
    callback.OutputSingleton(m_context, m_key + "-min", m_min);
79
  }
79
  }
(-)a/src/devices/csma/backoff.cc (-1 / +1 lines)
 Lines 67-73    Link Here 
67
67
68
  uint32_t backoffSlots = (uint32_t)m_rng.GetValue(minSlot, maxSlot);
68
  uint32_t backoffSlots = (uint32_t)m_rng.GetValue(minSlot, maxSlot);
69
69
70
  backoff = Scalar(backoffSlots) * m_slotTime;
70
  backoff = TimeScaleFactor(backoffSlots) * m_slotTime;
71
  return (backoff);
71
  return (backoff);
72
}
72
}
73
73
(-)a/src/devices/mesh/dot11s/hwmp-protocol.cc (-2 / +2 lines)
 Lines 963-969    Link Here 
963
  if (i == m_preqTimeouts.end ())
963
  if (i == m_preqTimeouts.end ())
964
    {
964
    {
965
      m_preqTimeouts[dst].preqTimeout = Simulator::Schedule (
965
      m_preqTimeouts[dst].preqTimeout = Simulator::Schedule (
966
          m_dot11MeshHWMPnetDiameterTraversalTime * Scalar (2),
966
          m_dot11MeshHWMPnetDiameterTraversalTime * TimeScaleFactor (2),
967
          &HwmpProtocol::RetryPathDiscovery, this, dst, 1);
967
          &HwmpProtocol::RetryPathDiscovery, this, dst, 1);
968
      m_preqTimeouts[dst].whenScheduled = Simulator::Now ();
968
      m_preqTimeouts[dst].whenScheduled = Simulator::Now ();
969
      return true;
969
      return true;
 Lines 1009-1015    Link Here 
1009
      i->second->RequestDestination (dst, originator_seqno, dst_seqno);
1009
      i->second->RequestDestination (dst, originator_seqno, dst_seqno);
1010
    }
1010
    }
1011
  m_preqTimeouts[dst].preqTimeout = Simulator::Schedule (
1011
  m_preqTimeouts[dst].preqTimeout = Simulator::Schedule (
1012
      Scalar (2 * (numOfRetry + 1)) *  m_dot11MeshHWMPnetDiameterTraversalTime,
1012
      TimeScaleFactor (2 * (numOfRetry + 1)) *  m_dot11MeshHWMPnetDiameterTraversalTime,
1013
      &HwmpProtocol::RetryPathDiscovery, this, dst, numOfRetry);
1013
      &HwmpProtocol::RetryPathDiscovery, this, dst, numOfRetry);
1014
}
1014
}
1015
//Proactive PREQ routines:
1015
//Proactive PREQ routines:
(-)a/src/devices/spectrum/waveform-generator.cc (-1 / +1 lines)
 Lines 173-179    Link Here 
173
void
173
void
174
WaveformGenerator::SetDutyCycle (double dutyCycle)
174
WaveformGenerator::SetDutyCycle (double dutyCycle)
175
{
175
{
176
  m_dutyCycle = Scalar (dutyCycle);
176
  m_dutyCycle = TimeScaleFactor (dutyCycle);
177
}
177
}
178
178
179
double WaveformGenerator::GetDutyCycle () const
179
double WaveformGenerator::GetDutyCycle () const
(-)a/src/devices/spectrum/waveform-generator.h (-1 / +1 lines)
 Lines 136-142    Link Here 
136
136
137
  Ptr<SpectrumValue> m_txPowerSpectralDensity;
137
  Ptr<SpectrumValue> m_txPowerSpectralDensity;
138
  Time   m_period;
138
  Time   m_period;
139
  Scalar m_dutyCycle;
139
  TimeScaleFactor m_dutyCycle;
140
  Time m_startTime;
140
  Time m_startTime;
141
  bool m_active;
141
  bool m_active;
142
142
(-)a/src/devices/wifi/mac-low.cc (-2 / +2 lines)
 Lines 987-993    Link Here 
987
    {
987
    {
988
      txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsMode, WIFI_PREAMBLE_LONG);
988
      txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsMode, WIFI_PREAMBLE_LONG);
989
      txTime += GetCtsDuration (hdr->GetAddr1 (), rtsMode);
989
      txTime += GetCtsDuration (hdr->GetAddr1 (), rtsMode);
990
      txTime += GetSifs () * Scalar (2);
990
      txTime += GetSifs () * TimeScaleFactor (2);
991
    }
991
    }
992
  uint32_t dataSize = GetSize (packet, hdr);
992
  uint32_t dataSize = GetSize (packet, hdr);
993
  txTime += m_phy->CalculateTxDuration (dataSize, dataMode, WIFI_PREAMBLE_LONG);
993
  txTime += m_phy->CalculateTxDuration (dataSize, dataMode, WIFI_PREAMBLE_LONG);
 Lines 1047-1053    Link Here 
1047
          cts.SetType (WIFI_MAC_CTL_CTS);
1047
          cts.SetType (WIFI_MAC_CTL_CTS);
1048
          Time navCounterResetCtsMissedDelay = 
1048
          Time navCounterResetCtsMissedDelay = 
1049
            m_phy->CalculateTxDuration (cts.GetSerializedSize (), txMode, preamble) +
1049
            m_phy->CalculateTxDuration (cts.GetSerializedSize (), txMode, preamble) +
1050
            Scalar (2) * GetSifs () + Scalar (2) * GetSlotTime ();
1050
            TimeScaleFactor (2) * GetSifs () + TimeScaleFactor (2) * GetSlotTime ();
1051
          m_navCounterResetCtsMissed = Simulator::Schedule (navCounterResetCtsMissedDelay,
1051
          m_navCounterResetCtsMissed = Simulator::Schedule (navCounterResetCtsMissedDelay,
1052
                                                            &MacLow::NavCounterResetCtsMissed, this,
1052
                                                            &MacLow::NavCounterResetCtsMissed, this,
1053
                                                            Simulator::Now ());
1053
                                                            Simulator::Now ());
(-)a/src/devices/wimax/bs-uplink-scheduler-mbqos.cc (-2 / +2 lines)
314
                      uInterval =
314
                      uInterval =
315
                        MilliSeconds ((*(ssRecord->GetServiceFlows (ServiceFlow::SF_TYPE_UGS).begin ()))->GetUnsolicitedGrantInterval ());
315
                        MilliSeconds ((*(ssRecord->GetServiceFlows (ServiceFlow::SF_TYPE_UGS).begin ()))->GetUnsolicitedGrantInterval ());
316
316
317
                      Scalar frame = ((timestamp - Simulator::Now ()) / frame_duration);
317
                      TimeScaleFactor frame = ((timestamp - Simulator::Now ()) / frame_duration);
318
318
319
                      if (frame.GetDouble () <= 1)
319
                      if (frame.GetDouble () <= 1)
320
                        {
320
                        {
668
              Time deadline = job->GetDeadline ();
668
              Time deadline = job->GetDeadline ();
669
              Time frame_duration = GetBs ()->GetPhy ()->GetFrameDuration ();
669
              Time frame_duration = GetBs ()->GetPhy ()->GetFrameDuration ();
670
670
671
              Scalar frame = ((deadline - Simulator::Now ()) / frame_duration);
671
              TimeScaleFactor frame = ((deadline - Simulator::Now ()) / frame_duration);
672
672
673
              NS_LOG_DEBUG ("At " << Simulator::Now ().GetSeconds () << " reserved traffic rate: "
673
              NS_LOG_DEBUG ("At " << Simulator::Now ().GetSeconds () << " reserved traffic rate: "
674
                                << job->GetServiceFlow ()->GetMinReservedTrafficRate ()
674
                                << job->GetServiceFlow ()->GetMinReservedTrafficRate ()
(-)a/src/internet-stack/rtt-estimator.cc (-5 / +5 lines)
 Lines 205-213    Link Here 
205
  if (nSamples)
205
  if (nSamples)
206
    { // Not first
206
    { // Not first
207
      Time err = m - est;
207
      Time err = m - est;
208
      est = est + Scalar (gain) * err;         // estimated rtt
208
      est = est + TimeScaleFactor (gain) * err;         // estimated rtt
209
      err = Abs (err);        // absolute value of error
209
      err = Abs (err);        // absolute value of error
210
      variance = variance + Scalar (gain) * (err - variance); // variance of rtt
210
      variance = variance + TimeScaleFactor (gain) * (err - variance); // variance of rtt
211
    }
211
    }
212
  else
212
  else
213
    { // First sample
213
    { // First sample
 Lines 223-235    Link Here 
223
  // If not enough samples, justjust return 2 times estimate   
223
  // If not enough samples, justjust return 2 times estimate   
224
  //if (nSamples < 2) return est * 2;
224
  //if (nSamples < 2) return est * 2;
225
  Time retval;
225
  Time retval;
226
  if (variance < est / Scalar (4.0))
226
  if (variance < est / TimeScaleFactor (4.0))
227
    {
227
    {
228
      retval = est * Scalar (2 * multiplier);            // At least twice current est
228
      retval = est * TimeScaleFactor (2 * multiplier);            // At least twice current est
229
    }
229
    }
230
  else
230
  else
231
    {
231
    {
232
      retval = (est + Scalar (4) * variance) * Scalar (multiplier); // As suggested by Jacobson
232
      retval = (est + TimeScaleFactor (4) * variance) * TimeScaleFactor (multiplier); // As suggested by Jacobson
233
    }
233
    }
234
  retval = Max (retval, minrto);
234
  retval = Max (retval, minrto);
235
  return retval;
235
  return retval;
(-)a/src/internet-stack/tcp-socket-impl.cc (-1 / +1 lines)
 Lines 1650-1656    Link Here 
1650
void TcpSocketImpl::PersistTimeout ()
1650
void TcpSocketImpl::PersistTimeout ()
1651
{
1651
{
1652
  NS_LOG_LOGIC ("PersistTimeout expired at "<<Simulator::Now ().GetSeconds ());
1652
  NS_LOG_LOGIC ("PersistTimeout expired at "<<Simulator::Now ().GetSeconds ());
1653
  m_persistTime = Scalar(2)*m_persistTime;
1653
  m_persistTime = TimeScaleFactor(2)*m_persistTime;
1654
  m_persistTime = std::min(Seconds(60),m_persistTime); //maxes out at 60
1654
  m_persistTime = std::min(Seconds(60),m_persistTime); //maxes out at 60
1655
  //the persist timeout sends exactly one byte probes
1655
  //the persist timeout sends exactly one byte probes
1656
  //this is explicit in stevens, and kind of in rfc793 p42, rfc1122 sec4.2.2.17
1656
  //this is explicit in stevens, and kind of in rfc793 p42, rfc1122 sec4.2.2.17
(-)a/src/routing/aodv/aodv-routing-protocol.cc (-14 / +14 lines)
 Lines 96-110    Link Here 
96
  ActiveRouteTimeout (Seconds (3)),
96
  ActiveRouteTimeout (Seconds (3)),
97
  NetDiameter (35),
97
  NetDiameter (35),
98
  NodeTraversalTime (MilliSeconds (40)),
98
  NodeTraversalTime (MilliSeconds (40)),
99
  NetTraversalTime (Scalar (2 * NetDiameter) * NodeTraversalTime),
99
  NetTraversalTime (TimeScaleFactor (2 * NetDiameter) * NodeTraversalTime),
100
  PathDiscoveryTime ( Scalar (2) * NetTraversalTime),
100
  PathDiscoveryTime ( TimeScaleFactor (2) * NetTraversalTime),
101
  MyRouteTimeout (Scalar (2) * std::max (PathDiscoveryTime, ActiveRouteTimeout)),
101
  MyRouteTimeout (TimeScaleFactor (2) * std::max (PathDiscoveryTime, ActiveRouteTimeout)),
102
  HelloInterval(Seconds (1)),
102
  HelloInterval(Seconds (1)),
103
  AllowedHelloLoss (2),
103
  AllowedHelloLoss (2),
104
  DeletePeriod (Scalar(5) * std::max(ActiveRouteTimeout, HelloInterval)),
104
  DeletePeriod (TimeScaleFactor(5) * std::max(ActiveRouteTimeout, HelloInterval)),
105
  NextHopWait (NodeTraversalTime + MilliSeconds (10)),
105
  NextHopWait (NodeTraversalTime + MilliSeconds (10)),
106
  TimeoutBuffer (2),
106
  TimeoutBuffer (2),
107
  BlackListTimeout(Scalar (RreqRetries) * NetTraversalTime),
107
  BlackListTimeout(TimeScaleFactor (RreqRetries) * NetTraversalTime),
108
  MaxQueueLen (64),
108
  MaxQueueLen (64),
109
  MaxQueueTime (Seconds(30)),
109
  MaxQueueTime (Seconds(30)),
110
  DestinationOnly (false),
110
  DestinationOnly (false),
 Lines 758-764    Link Here 
758
  if (EnableHello)
758
  if (EnableHello)
759
    {
759
    {
760
      m_htimer.Cancel ();
760
      m_htimer.Cancel ();
761
      m_htimer.Schedule (HelloInterval - Scalar (0.01) * MilliSeconds (UniformVariable ().GetInteger (0, 10)));
761
      m_htimer.Schedule (HelloInterval - TimeScaleFactor (0.01) * MilliSeconds (UniformVariable ().GetInteger (0, 10)));
762
    }
762
    }
763
}
763
}
764
764
 Lines 778-784    Link Here 
778
  m_routingTable.LookupRoute (dst, rt);
778
  m_routingTable.LookupRoute (dst, rt);
779
  rt.IncrementRreqCnt ();
779
  rt.IncrementRreqCnt ();
780
  m_routingTable.Update (rt);
780
  m_routingTable.Update (rt);
781
  m_addressReqTimer[dst].Schedule (Scalar (rt.GetRreqCnt ()) * NetTraversalTime);
781
  m_addressReqTimer[dst].Schedule (TimeScaleFactor (rt.GetRreqCnt ()) * NetTraversalTime);
782
}
782
}
783
783
784
void
784
void
 Lines 912-918    Link Here 
912
      Ptr<NetDevice> dev = m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver));
912
      Ptr<NetDevice> dev = m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver));
913
      RoutingTableEntry newEntry (/*device=*/dev, /*dst=*/origin, /*validSeno=*/true, /*seqNo=*/rreqHeader.GetOriginSeqno (),
913
      RoutingTableEntry newEntry (/*device=*/dev, /*dst=*/origin, /*validSeno=*/true, /*seqNo=*/rreqHeader.GetOriginSeqno (),
914
                                  /*iface=*/m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0), /*hops=*/hop,
914
                                  /*iface=*/m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0), /*hops=*/hop,
915
                                  /*nextHop*/src, /*timeLife=*/Scalar (2) * NetTraversalTime - Scalar (2 * hop) * NodeTraversalTime);
915
                                  /*nextHop*/src, /*timeLife=*/TimeScaleFactor (2) * NetTraversalTime - TimeScaleFactor (2 * hop) * NodeTraversalTime);
916
      m_routingTable.AddRoute (newEntry);
916
      m_routingTable.AddRoute (newEntry);
917
    }
917
    }
918
  else
918
  else
 Lines 929-935    Link Here 
929
      toOrigin.SetOutputDevice (m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver)));
929
      toOrigin.SetOutputDevice (m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver)));
930
      toOrigin.SetInterface (m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0));
930
      toOrigin.SetInterface (m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0));
931
      toOrigin.SetHop (hop);
931
      toOrigin.SetHop (hop);
932
      toOrigin.SetLifeTime (std::max (Scalar (2) * NetTraversalTime - Scalar (2 * hop) * NodeTraversalTime, toOrigin.GetLifeTime ()));
932
      toOrigin.SetLifeTime (std::max (TimeScaleFactor (2) * NetTraversalTime - TimeScaleFactor (2 * hop) * NodeTraversalTime, toOrigin.GetLifeTime ()));
933
      m_routingTable.Update (toOrigin);
933
      m_routingTable.Update (toOrigin);
934
    }
934
    }
935
  NS_LOG_LOGIC (receiver << " receive RREQ to destination " << rreqHeader.GetDst ());
935
  NS_LOG_LOGIC (receiver << " receive RREQ to destination " << rreqHeader.GetDst ());
 Lines 985-991    Link Here 
985
  if (EnableHello)
985
  if (EnableHello)
986
    {
986
    {
987
      m_htimer.Cancel ();
987
      m_htimer.Cancel ();
988
      m_htimer.Schedule (HelloInterval - Scalar(0.1)*MilliSeconds(UniformVariable().GetInteger (0, 10)));
988
      m_htimer.Schedule (HelloInterval - TimeScaleFactor(0.1)*MilliSeconds(UniformVariable().GetInteger (0, 10)));
989
    }
989
    }
990
}
990
}
991
991
 Lines 1232-1238    Link Here 
1232
    }
1232
    }
1233
  else
1233
  else
1234
    {
1234
    {
1235
      toNeighbor.SetLifeTime (std::max (Scalar (AllowedHelloLoss) * HelloInterval, toNeighbor.GetLifeTime ()));
1235
      toNeighbor.SetLifeTime (std::max (TimeScaleFactor (AllowedHelloLoss) * HelloInterval, toNeighbor.GetLifeTime ()));
1236
      toNeighbor.SetSeqNo (rrepHeader.GetDstSeqno ());
1236
      toNeighbor.SetSeqNo (rrepHeader.GetDstSeqno ());
1237
      toNeighbor.SetValidSeqNo (true);
1237
      toNeighbor.SetValidSeqNo (true);
1238
      toNeighbor.SetFlag (VALID);
1238
      toNeighbor.SetFlag (VALID);
 Lines 1242-1248    Link Here 
1242
    }
1242
    }
1243
  if (EnableHello)
1243
  if (EnableHello)
1244
    {
1244
    {
1245
      m_nb.Update (rrepHeader.GetDst (), Scalar (AllowedHelloLoss) * HelloInterval);
1245
      m_nb.Update (rrepHeader.GetDst (), TimeScaleFactor (AllowedHelloLoss) * HelloInterval);
1246
    }
1246
    }
1247
}
1247
}
1248
1248
 Lines 1352-1358    Link Here 
1352
  NS_LOG_FUNCTION (this);
1352
  NS_LOG_FUNCTION (this);
1353
  SendHello ();
1353
  SendHello ();
1354
  m_htimer.Cancel ();
1354
  m_htimer.Cancel ();
1355
  Time t = Scalar(0.01)*MilliSeconds(UniformVariable().GetInteger (0, 100));
1355
  Time t = TimeScaleFactor(0.01)*MilliSeconds(UniformVariable().GetInteger (0, 100));
1356
  m_htimer.Schedule (HelloInterval - t);
1356
  m_htimer.Schedule (HelloInterval - t);
1357
}
1357
}
1358
1358
 Lines 1386-1392    Link Here 
1386
      Ptr<Socket> socket = j->first;
1386
      Ptr<Socket> socket = j->first;
1387
      Ipv4InterfaceAddress iface = j->second;
1387
      Ipv4InterfaceAddress iface = j->second;
1388
      RrepHeader helloHeader (/*prefix size=*/0, /*hops=*/0, /*dst=*/iface.GetLocal (), /*dst seqno=*/m_seqNo,
1388
      RrepHeader helloHeader (/*prefix size=*/0, /*hops=*/0, /*dst=*/iface.GetLocal (), /*dst seqno=*/m_seqNo,
1389
                              /*origin=*/iface.GetLocal (),/*lifetime=*/Scalar (AllowedHelloLoss) * HelloInterval);
1389
                              /*origin=*/iface.GetLocal (),/*lifetime=*/TimeScaleFactor (AllowedHelloLoss) * HelloInterval);
1390
      Ptr<Packet> packet = Create<Packet> ();
1390
      Ptr<Packet> packet = Create<Packet> ();
1391
      packet->AddHeader (helloHeader);
1391
      packet->AddHeader (helloHeader);
1392
      TypeHeader tHeader (AODVTYPE_RREP);
1392
      TypeHeader tHeader (AODVTYPE_RREP);
(-)a/src/routing/aodv/test/aodv-regression.cc (-1 / +1 lines)
 Lines 101-107    Link Here 
101
  // At m_time / 3 move central node away and see what will happen
101
  // At m_time / 3 move central node away and see what will happen
102
  Ptr<Node> node = m_nodes->Get (m_size / 2);
102
  Ptr<Node> node = m_nodes->Get (m_size / 2);
103
  Ptr<MobilityModel> mob = node->GetObject<MobilityModel> ();
103
  Ptr<MobilityModel> mob = node->GetObject<MobilityModel> ();
104
  Simulator::Schedule (m_time / Scalar(3.0), &MobilityModel::SetPosition, mob, Vector (1e5, 1e5, 1e5));
104
  Simulator::Schedule (m_time / TimeScaleFactor(3.0), &MobilityModel::SetPosition, mob, Vector (1e5, 1e5, 1e5));
105
105
106
  Simulator::Stop (m_time);
106
  Simulator::Stop (m_time);
107
  Simulator::Run ();
107
  Simulator::Run ();
(-)a/src/routing/olsr/olsr-routing-protocol.cc (-4 / +4 lines)
 Lines 73-87    Link Here 
73
/********** Holding times **********/
73
/********** Holding times **********/
74
74
75
/// Neighbor holding time.
75
/// Neighbor holding time.
76
#define OLSR_NEIGHB_HOLD_TIME	(Scalar (3) * OLSR_REFRESH_INTERVAL)
76
#define OLSR_NEIGHB_HOLD_TIME	(TimeScaleFactor (3) * OLSR_REFRESH_INTERVAL)
77
/// Top holding time.
77
/// Top holding time.
78
#define OLSR_TOP_HOLD_TIME	(Scalar (3) * m_tcInterval)
78
#define OLSR_TOP_HOLD_TIME	(TimeScaleFactor (3) * m_tcInterval)
79
/// Dup holding time.
79
/// Dup holding time.
80
#define OLSR_DUP_HOLD_TIME	Seconds (30)
80
#define OLSR_DUP_HOLD_TIME	Seconds (30)
81
/// MID holding time.
81
/// MID holding time.
82
#define OLSR_MID_HOLD_TIME	(Scalar (3) * m_midInterval)
82
#define OLSR_MID_HOLD_TIME	(TimeScaleFactor (3) * m_midInterval)
83
/// HNA holding time.
83
/// HNA holding time.
84
#define OLSR_HNA_HOLD_TIME  (Scalar (3) * m_hnaInterval)
84
#define OLSR_HNA_HOLD_TIME  (TimeScaleFactor (3) * m_hnaInterval)
85
85
86
/********** Link types **********/
86
/********** Link types **********/
87
87
(-)a/src/simulator/nstime.h (-15 / +19 lines)
 Lines 80-86    Link Here 
80
 * multiply multiple TimeUnit objects. The return type of any such
80
 * multiply multiple TimeUnit objects. The return type of any such
81
 * arithmetic expression is always a TimeUnit object.
81
 * arithmetic expression is always a TimeUnit object.
82
 *
82
 *
83
 * The ns3::Scalar, ns3::Time, ns3::TimeSquare, and ns3::TimeInvert classes
83
 * The ns3::TimeScaleFactor, ns3::Time, ns3::TimeSquare, and ns3::TimeInvert classes
84
 * are aliases for the TimeUnit<0>, TimeUnit<1>, TimeUnit<2> and TimeUnit<-1>
84
 * are aliases for the TimeUnit<0>, TimeUnit<1>, TimeUnit<2> and TimeUnit<-1>
85
 * types respectively.
85
 * types respectively.
86
 *
86
 *
 Lines 93-99    Link Here 
93
 * Time<3> t5 = t3 * t1;
93
 * Time<3> t5 = t3 * t1;
94
 * Time<-2> t6 = t1 / t5;
94
 * Time<-2> t6 = t1 / t5;
95
 * TimeSquare t7 = t3;
95
 * TimeSquare t7 = t3;
96
 * Scalar s = t4;
96
 * TimeScaleFactor s = t4;
97
 * \endcode
97
 * \endcode
98
 *
98
 *
99
 * If you try to assign the result of an expression which does not
99
 * If you try to assign the result of an expression which does not
 Lines 489-495    Link Here 
489
 * the standard C++ operators (if you make sure to obey the rules
489
 * the standard C++ operators (if you make sure to obey the rules
490
 * of the ns3::TimeUnit class template)
490
 * of the ns3::TimeUnit class template)
491
 * To scale a Time instance, you can multiply it with an instance of
491
 * To scale a Time instance, you can multiply it with an instance of
492
 * the ns3::Scalar class.
492
 * the ns3::TimeScaleFactor class.
493
 * Time instances can also be manipulated through the following non-member
493
 * Time instances can also be manipulated through the following non-member
494
 * functions:
494
 * functions:
495
 *  - \ref ns3-Time-Abs ns3::Abs
495
 *  - \ref ns3-Time-Abs ns3::Abs
 Lines 620-626    Link Here 
620
  // -*- New methods -*-
620
  // -*- New methods -*-
621
public:
621
public:
622
  double GetDouble (void) const;
622
  double GetDouble (void) const;
623
  TimeUnit<0> (double scalar);
623
  TimeUnit<0> (double timescale);
624
624
625
  // -*- The rest is the the same as in the generic template class -*-
625
  // -*- The rest is the the same as in the generic template class -*-
626
public:
626
public:
 Lines 675-707    Link Here 
675
};
675
};
676
676
677
/**
677
/**
678
 * \brief hold scalar values
678
 * \brief hold timescale values
679
 *
679
 *
680
 * This class is used both to construct scalar values to multiply
680
 * This class is used both to construct timescale 
681
 * ns3::Time instances and to hold the return value of
681
 * values to multiply ns3::Time instances and to 
682
 * an expression which returns a scalar. For example, the
682
 * hold the return value of an expression which returns 
683
 * a timescale value. For example, the
683
 * following code will output on your terminal 1.5:
684
 * following code will output on your terminal 1.5:
684
 * \code
685
 * \code
685
 * Scalar s0 = Scalar (1.5);
686
 * TimeScaleFactor s0 = TimeScaleFactor (1.5);
686
 * Time t1 = Seconds (10.0) * s0;
687
 * Time t1 = Seconds (10.0) * s0;
687
 * Time t2 = Seconds (10.0) * Scalar (2.5);
688
 * Time t2 = Seconds (10.0) * TimeScaleFactor (2.5);
688
 * Scalar s1 = Seconds (15.0) / Seconds (10.0);
689
 * TimeScaleFactor s1 = Seconds (15.0) / Seconds (10.0);
689
 * std::cout << s1.GetDouble () << std::endl;
690
 * std::cout << s1.GetDouble () << std::endl;
690
 * \endcode
691
 * \endcode
691
 *
692
 *
692
 * The Scalar class has the following additional methods not available in
693
 * The TimeScaleFactor class has the following additional methods not available in
693
 * the generic TimeUnit template:
694
 * the generic TimeUnit template:
694
 * \code
695
 * \code
695
 * double GetDouble (void) const;
696
 * double GetDouble (void) const;
696
 * \endcode
697
 * \endcode
697
 * returns the C double contained in the Scalar instance
698
 * returns the C double contained in the TimeScaleFactor instance
698
 *
699
 *
699
 * \code
700
 * \code
700
 * Scalar(double scalar);
701
 * TimeScaleFactor(double timescale);
701
 * \endcode
702
 * \endcode
702
 * Constructs a Scalar instance from a C double.
703
 * Constructs a TimeScaleFactor instance from a C double.
703
 */
704
 */
705
706
// Scalar is deprecated; use TimeUnit<0> or TimeScaleFactor instead
704
typedef TimeUnit<0> Scalar;
707
typedef TimeUnit<0> Scalar;
708
typedef TimeUnit<0> TimeScaleFactor;
705
709
706
typedef TimeUnit<-1> TimeInvert;
710
typedef TimeUnit<-1> TimeInvert;
707
typedef TimeUnit<2> TimeSquare;
711
typedef TimeUnit<2> TimeSquare;
(-)a/src/simulator/time.cc (-10 / +10 lines)
 Lines 350-357    Link Here 
350
  return Time (HighPrecision (ts, false));
350
  return Time (HighPrecision (ts, false));
351
}
351
}
352
352
353
TimeUnit<0>::TimeUnit (double scalar)
353
TimeUnit<0>::TimeUnit (double timescale)
354
  : m_data (HighPrecision (scalar))
354
  : m_data (HighPrecision (timescale))
355
{
355
{
356
}
356
}
357
357
 Lines 433-448    Link Here 
433
  NS_TEST_ASSERT_MSG_EQ ((MilliSeconds (0) > NanoSeconds (0)), false, "Zero is bigger than Zero ?");
433
  NS_TEST_ASSERT_MSG_EQ ((MilliSeconds (0) > NanoSeconds (0)), false, "Zero is bigger than Zero ?");
434
  NS_TEST_ASSERT_MSG_EQ ((MilliSeconds (0) < NanoSeconds (0)), false, "Zero is smaller than Zero ?");
434
  NS_TEST_ASSERT_MSG_EQ ((MilliSeconds (0) < NanoSeconds (0)), false, "Zero is smaller than Zero ?");
435
435
436
  Time t4 = Seconds (10.0) * Scalar (1.5);
436
  Time t4 = Seconds (10.0) * TimeScaleFactor (1.5);
437
  ASSERT_EQ (t4.GetSeconds (), 15.0);
437
  ASSERT_EQ (t4.GetSeconds (), 15.0);
438
438
439
  Time t5 = NanoSeconds (10) * Scalar (1.5);
439
  Time t5 = NanoSeconds (10) * TimeScaleFactor (1.5);
440
  ASSERT_EQ (t5.GetNanoSeconds (), 15.0);
440
  ASSERT_EQ (t5.GetNanoSeconds (), 15.0);
441
441
442
  Time t6 = Seconds (10.0) * Scalar (15) / Scalar (10);
442
  Time t6 = Seconds (10.0) * TimeScaleFactor (15) / TimeScaleFactor (10);
443
  ASSERT_EQ (t6.GetSeconds (), 15.0);
443
  ASSERT_EQ (t6.GetSeconds (), 15.0);
444
444
445
  Time t7 = NanoSeconds (10) * Scalar (15) / Scalar (10);
445
  Time t7 = NanoSeconds (10) * TimeScaleFactor (15) / TimeScaleFactor (10);
446
  ASSERT_EQ (t7.GetNanoSeconds (), 15.0);
446
  ASSERT_EQ (t7.GetNanoSeconds (), 15.0);
447
447
448
  ASSERT_EQ ((t1 + t2).GetSeconds (), t1.GetSeconds () + t2.GetSeconds ());
448
  ASSERT_EQ ((t1 + t2).GetSeconds (), t1.GetSeconds () + t2.GetSeconds ());
 Lines 492-499    Link Here 
492
             (t0.GetSeconds () / t1.GetSeconds () * (t0.GetSeconds () - t1.GetSeconds ())));
492
             (t0.GetSeconds () / t1.GetSeconds () * (t0.GetSeconds () - t1.GetSeconds ())));
493
  ASSERT_EQ (((t0 / t1) * (t0 - t1)).GetSeconds (),
493
  ASSERT_EQ (((t0 / t1) * (t0 - t1)).GetSeconds (),
494
             (t0.GetSeconds () / t1.GetSeconds ()) * (t0.GetSeconds () - t1.GetSeconds ()));
494
             (t0.GetSeconds () / t1.GetSeconds ()) * (t0.GetSeconds () - t1.GetSeconds ()));
495
  ASSERT_EQ ((t0 * Scalar (10.0)).GetSeconds (), (t0.GetSeconds () * 10.0));
495
  ASSERT_EQ ((t0 * TimeScaleFactor (10.0)).GetSeconds (), (t0.GetSeconds () * 10.0));
496
  ASSERT_EQ ((Scalar (10.0) * t0).GetSeconds (), (10.0 * t0.GetSeconds ()));
496
  ASSERT_EQ ((TimeScaleFactor (10.0) * t0).GetSeconds (), (10.0 * t0.GetSeconds ()));
497
497
498
  // Note: we need to multiply by 1e9 because GetSeconds is multiplying
498
  // Note: we need to multiply by 1e9 because GetSeconds is multiplying
499
  ASSERT_EQ (((t0 / (t1 * (t0 - t1))).GetHighPrecision ().GetDouble () * 1e9),
499
  ASSERT_EQ (((t0 / (t1 * (t0 - t1))).GetHighPrecision ().GetDouble () * 1e9),
 Lines 704-711    Link Here 
704
704
705
bool Bug863TestCase::DoRun (void)
705
bool Bug863TestCase::DoRun (void)
706
{
706
{
707
  Scalar result = Scalar (0.9) / Scalar (1.0);
707
  TimeScaleFactor result = TimeScaleFactor (0.9) / TimeScaleFactor (1.0);
708
  NS_TEST_ASSERT_MSG_EQ ((result == Scalar (0.9)), true, "Invalid arithmetic result");
708
  NS_TEST_ASSERT_MSG_EQ ((result == TimeScaleFactor (0.9)), true, "Invalid arithmetic result");
709
  return false;
709
  return false;
710
}
710
}
711
711
(-)a/utils/python-unit-tests.py (-1 / +1 lines)
 Lines 53-59    Link Here 
53
        self.assertEqual(ns3.Seconds(10) + ns3.Seconds(5), ns3.Seconds(15))
53
        self.assertEqual(ns3.Seconds(10) + ns3.Seconds(5), ns3.Seconds(15))
54
        self.assertEqual(ns3.Seconds(10) - ns3.Seconds(5), ns3.Seconds(5))
54
        self.assertEqual(ns3.Seconds(10) - ns3.Seconds(5), ns3.Seconds(5))
55
55
56
        v1 = ns3.Scalar(5)*ns3.Seconds(10)
56
        v1 = ns3.TimeScaleFactor(5)*ns3.Seconds(10)
57
        self.assertEqual(v1, ns3.Seconds(50))
57
        self.assertEqual(v1, ns3.Seconds(50))
58
58
59
    def testConfig(self):
59
    def testConfig(self):

Return to bug 445