Simulation virtual time values and global simulation resolution. More...
#include <nstime.h>
Classes | |
struct | Information |
How to convert between other units and the current unit. More... | |
struct | Resolution |
Current time unit, and conversion info. More... | |
Public Types | |
enum | Unit { Y = 0, D = 1, H = 2, MIN = 3, S = 4, MS = 5, US = 6, NS = 7, PS = 8, FS = 9, LAST = 10 } |
The unit to use to interpret a number representing time. More... | |
Public Member Functions | |
Time () | |
Default constructor, with value 0. More... | |
Time (const Time &o) | |
Copy constructor. More... | |
Time (const std::string &s) | |
Construct Time object from common time expressions like "1ms". More... | |
~Time () | |
Destructor. More... | |
TimeWithUnit | As (const enum Unit unit) const |
Attach a unit to a Time, to facilitate output in a specific unit. More... | |
int | Compare (const Time &o) const |
Compare this to another Time. More... | |
bool | IsNegative (void) const |
bool | IsPositive (void) const |
bool | IsStrictlyNegative (void) const |
bool | IsStrictlyPositive (void) const |
bool | IsZero (void) const |
operator int64x64_t () const | |
Cast to int64x64_t. More... | |
Time & | operator= (const Time &o) |
Assignment operator. More... | |
Time (double v) | |
Construct from a numeric value. More... | |
Time (int v) | |
Construct from a numeric value. More... | |
Time (long int v) | |
Construct from a numeric value. More... | |
Time (long long int v) | |
Construct from a numeric value. More... | |
Time (unsigned int v) | |
Construct from a numeric value. More... | |
Time (unsigned long int v) | |
Construct from a numeric value. More... | |
Time (unsigned long long int v) | |
Construct from a numeric value. More... | |
Time (const int64x64_t &v) | |
Construct from a numeric value. More... | |
double | GetYears (void) const |
Get an approximation of the time stored in this instance in the indicated unit. More... | |
double | GetDays (void) const |
Get an approximation of the time stored in this instance in the indicated unit. More... | |
double | GetHours (void) const |
Get an approximation of the time stored in this instance in the indicated unit. More... | |
double | GetMinutes (void) const |
Get an approximation of the time stored in this instance in the indicated unit. More... | |
double | GetSeconds (void) const |
Get an approximation of the time stored in this instance in the indicated unit. More... | |
int64_t | GetMilliSeconds (void) const |
Get an approximation of the time stored in this instance in the indicated unit. More... | |
int64_t | GetMicroSeconds (void) const |
Get an approximation of the time stored in this instance in the indicated unit. More... | |
int64_t | GetNanoSeconds (void) const |
Get an approximation of the time stored in this instance in the indicated unit. More... | |
int64_t | GetPicoSeconds (void) const |
Get an approximation of the time stored in this instance in the indicated unit. More... | |
int64_t | GetFemtoSeconds (void) const |
Get an approximation of the time stored in this instance in the indicated unit. More... | |
int64_t | GetTimeStep (void) const |
double | GetDouble (void) const |
int64_t | GetInteger (void) const |
int64_t | ToInteger (enum Unit unit) const |
Get the Time value expressed in a particular unit. More... | |
double | ToDouble (enum Unit unit) const |
Get the Time value expressed in a particular unit. More... | |
int64x64_t | To (enum Unit unit) const |
Get the Time value expressed in a particular unit. More... | |
Static Public Member Functions | |
static Time | From (const int64x64_t &value) |
Create a Time in the current unit. More... | |
static enum Unit | GetResolution (void) |
static Time | Max () |
Maximum representable Time. More... | |
static Time | Min () |
Minimum representable Time. More... | |
static void | SetResolution (enum Unit resolution) |
static bool | StaticInit () |
Function to force static initialization of Time. More... | |
static Time | FromInteger (uint64_t value, enum Unit unit) |
Create a Time equal to value in unit unit . More... | |
static Time | FromDouble (double value, enum Unit unit) |
Create a Time equal to value in unit unit . More... | |
static Time | From (const int64x64_t &value, enum Unit unit) |
Create a Time equal to value in unit unit . More... | |
Private Types | |
typedef std::set< Time * > | MarkedTimes |
Record all instances of Time, so we can rescale them when the resolution changes. More... | |
Static Private Member Functions | |
static void | Clear (Time *const time) |
Remove a Time instance from the MarkedTimes, called by ~Time(). More... | |
static void | ClearMarkedTimes () |
Remove all MarkedTimes. More... | |
static void | ConvertTimes (const enum Unit unit) |
Convert existing Times to the new unit. More... | |
static void | Mark (Time *const time) |
Record a Time instance with the MarkedTimes. More... | |
static struct Information * | PeekInformation (enum Unit timeUnit) |
Get the Information record for timeUnit for the current Resolution. More... | |
static struct Resolution * | PeekResolution (void) |
Get the current Resolution. More... | |
static struct Resolution | SetDefaultNsResolution (void) |
Set the default resolution. More... | |
static void | SetResolution (enum Unit unit, struct Resolution *resolution, const bool convert=true) |
Set the current Resolution. More... | |
Private Attributes | |
int64_t | m_data |
Virtual time value, in the current unit. More... | |
Static Private Attributes | |
static MarkedTimes * | g_markingTimes = 0 |
Record of outstanding Time objects which will need conversion when the resolution is set. More... | |
Friends | |
Time | Abs (const Time &time) |
Absolute value function for Time. More... | |
Time | Max (const Time &ta, const Time &tb) |
Max function for Time. More... | |
Time | Min (const Time &ta, const Time &tb) |
Min function for Time. More... | |
class | Simulator |
bool | operator== (const Time &lhs, const Time &rhs) |
Arithmetic operator. More... | |
bool | operator!= (const Time &lhs, const Time &rhs) |
Arithmetic operator. More... | |
bool | operator<= (const Time &lhs, const Time &rhs) |
Arithmetic operator. More... | |
bool | operator>= (const Time &lhs, const Time &rhs) |
Arithmetic operator. More... | |
bool | operator< (const Time &lhs, const Time &rhs) |
Arithmetic operator. More... | |
bool | operator> (const Time &lhs, const Time &rhs) |
Arithmetic operator. More... | |
Time | operator+ (const Time &lhs, const Time &rhs) |
Arithmetic operator. More... | |
Time | operator- (const Time &lhs, const Time &rhs) |
Arithmetic operator. More... | |
Time | operator* (const Time &lhs, const int64_t &rhs) |
Arithmetic operator. More... | |
Time | operator* (const int64_t &lhs, const Time &rhs) |
Arithmetic operator. More... | |
int64_t | operator/ (const Time &lhs, const Time &rhs) |
Arithmetic operator. More... | |
Time | operator/ (const Time &lhs, const int64_t &rhs) |
Arithmetic operator. More... | |
Time & | operator+= (Time &lhs, const Time &rhs) |
Arithmetic operator. More... | |
Time & | operator-= (Time &lhs, const Time &rhs) |
Arithmetic operator. More... | |
Related Functions | |
(Note that these are not member functions.) | |
SystemMutex & | GetMarkingMutex () |
Simulation virtual time values and global simulation resolution.
This class defines all the classic C++ addition/subtraction operators: +, -, +=, -=; and all the classic comparison operators: ==, !=, <, >, <=, >=. It is thus easy to add, substract, or compare Time objects.
For example:
You can also use the following non-member functions to manipulate any of these ns3::Time object:
This class also controls the resolution of the underlying time value. The resolution is the smallest representable time interval. The default resolution is nanoseconds.
To change the resolution, use SetResolution(). All Time objects created before the call to SetResolution() will be updated to the new resolution. This can only be done once! (Tracking each Time object uses 4 pointers. For speed, once we convert the existing instances we discard the recording data structure and stop tracking new instances, so we have no way to do a second conversion.)
If you increase the global resolution, you also implicitly decrease the range of your simulation. The global simulation time is stored in a 64 bit integer, whose interpretation will depend on the global resolution. Therefore the maximum duration of your simulation, if you use picoseconds, is 2^64 ps = 2^24 s = 7 months, whereas, had you used nanoseconds, you could have run for 584 years.
|
private |
Record all instances of Time, so we can rescale them when the resolution changes.
We use a std::set so we can remove the record easily when ~Time() is called.
We don't use Ptr<Time>, because we would have to bloat every Time instance with SimpleRefCount<Time>.
Seems like this should be std::set< Time * const >, but Stack Overflow says otherwise, quoting the standard:
& sect;23.1/3 states that std::set key types must be assignable and copy constructable; clearly a const type will not be assignable.
enum ns3::Time::Unit |
|
inline |
Default constructor, with value 0.
Definition at line 127 of file nstime.h.
References g_markingTimes, and Mark().
Referenced by From(), FromInteger(), Max(), and Min().
|
inline |
Copy constructor.
[in] | o | Time to copy |
Definition at line 140 of file nstime.h.
References g_markingTimes, and Mark().
|
inlineexplicit |
Construct from a numeric value.
The current time resolution will be assumed as the unit.
[in] | v | The value. |
Definition at line 155 of file nstime.h.
References g_markingTimes, and Mark().
|
inlineexplicit |
Construct from a numeric value.
The current time resolution will be assumed as the unit.
[in] | v | The value. |
Definition at line 163 of file nstime.h.
References g_markingTimes, and Mark().
|
inlineexplicit |
Construct from a numeric value.
The current time resolution will be assumed as the unit.
[in] | v | The value. |
Definition at line 171 of file nstime.h.
References g_markingTimes, and Mark().
|
inlineexplicit |
Construct from a numeric value.
The current time resolution will be assumed as the unit.
[in] | v | The value. |
Definition at line 179 of file nstime.h.
References g_markingTimes, and Mark().
|
inlineexplicit |
Construct from a numeric value.
The current time resolution will be assumed as the unit.
[in] | v | The value. |
Definition at line 187 of file nstime.h.
References g_markingTimes, and Mark().
|
inlineexplicit |
Construct from a numeric value.
The current time resolution will be assumed as the unit.
[in] | v | The value. |
Definition at line 195 of file nstime.h.
References g_markingTimes, and Mark().
|
inlineexplicit |
Construct from a numeric value.
The current time resolution will be assumed as the unit.
[in] | v | The value. |
Definition at line 203 of file nstime.h.
References g_markingTimes, and Mark().
|
inlineexplicit |
Construct from a numeric value.
The current time resolution will be assumed as the unit.
[in] | v | The value. |
Definition at line 211 of file nstime.h.
References g_markingTimes, and Mark().
|
explicit |
Construct Time object from common time expressions like "1ms".
Supported units include:
s
(seconds)ms
(milliseconds)us
(microseconds)ns
(nanoseconds)ps
(picoseconds)fs
(femtoseconds)min
(minutes)h
(hours)d
(days)y
(years)There can be no white space between the numerical portion and the units. Any otherwise malformed string causes a fatal error to occur.
s | The string to parse into a Time |
Definition at line 94 of file time.cc.
References D, FromDouble(), FS, g_markingTimes, H, Mark(), MIN, MS, NS, NS_ABORT_MSG, NS_LOG_FUNCTION, PS, S, US, and Y.
|
inline |
Destructor.
Definition at line 255 of file nstime.h.
References Clear(), and g_markingTimes.
TimeWithUnit ns3::Time::As | ( | const enum Unit | unit | ) | const |
Attach a unit to a Time, to facilitate output in a specific unit.
For example,
will print +3140.0ms
unit | [in] The unit to use. |
Definition at line 386 of file time.cc.
Referenced by TimeIntputOutputTestCase::DoRun(), and ns3::operator<<().
|
staticprivate |
Remove a Time instance from the MarkedTimes, called by ~Time().
[in] | time | The Time instance to remove. |
Definition at line 311 of file time.cc.
References g_markingTimes, GetMarkingMutex(), NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, and NS_LOG_WARN.
Referenced by ~Time().
|
staticprivate |
Remove all MarkedTimes.
We're called by Simulator::Run, which knows nothing about the mutex, so we need a critical section here.
It would seem natural to use this function at the end of ConvertTimes, but that function already has the mutex. Our SystemMutex throws a fatal error if we try to lock it more than once in the same thread (at least in the unix implementation), so calling this function from ConvertTimes is a bad idea.
Instead, we copy this body into ConvertTimes.
Definition at line 254 of file time.cc.
References g_markingTimes, GetMarkingMutex(), NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.
Referenced by ns3::Simulator::Run().
|
inline |
|
staticprivate |
Convert existing Times to the new unit.
[in] | unit | The Unit to convert existing Times to. |
Definition at line 341 of file time.cc.
References g_markingTimes, GetMarkingMutex(), m_data, NS_ASSERT_MSG, NS_LOG_FUNCTION_NOARGS, NS_LOG_LOGIC, and ToInteger().
Referenced by SetResolution().
|
inlinestatic |
Create a Time in the current unit.
[in] | value | The value of the new Time. |
value
in the current time unit. Definition at line 387 of file nstime.h.
References Time().
Referenced by ns3::Days(), ns3::FemtoSeconds(), FromDouble(), ns3::Hours(), ns3::MicroSeconds(), ns3::MilliSeconds(), ns3::Minutes(), ns3::NanoSeconds(), ns3::PicoSeconds(), ns3::Seconds(), and ns3::Years().
|
inlinestatic |
Create a Time equal to value
in unit unit
.
[in] | value | The new Time value, expressed in unit |
[in] | unit | The unit of value |
value
in unit
Definition at line 416 of file nstime.h.
References ns3::Time::Information::fromMul, ns3::int64x64_t::MulByInvert(), PeekInformation(), Time(), and ns3::Time::Information::timeFrom.
Create a Time equal to value
in unit unit
.
[in] | value | The new Time value, expressed in unit |
[in] | unit | The unit of value |
value
in unit
Definition at line 412 of file nstime.h.
References From().
Referenced by ns3::Days(), ns3::Hours(), ns3::RttMeanDeviation::Measurement(), ns3::Minutes(), ns3::Seconds(), Time(), and ns3::Years().
Create a Time equal to value
in unit unit
.
[in] | value | The new Time value, expressed in unit |
[in] | unit | The unit of value |
value
in unit
Definition at line 399 of file nstime.h.
References ns3::Time::Information::factor, ns3::Time::Information::fromMul, PeekInformation(), and Time().
Referenced by ns3::FemtoSeconds(), ns3::MicroSeconds(), ns3::MilliSeconds(), ns3::NanoSeconds(), ns3::PicoSeconds(), and ns3::RttMeanDeviation::RetransmitTimeout().
|
inline |
Get an approximation of the time stored in this instance in the indicated unit.
Definition at line 310 of file nstime.h.
References D, and ToDouble().
|
inline |
|
inline |
Get an approximation of the time stored in this instance in the indicated unit.
Definition at line 342 of file nstime.h.
References FS, and ToInteger().
|
inline |
Get an approximation of the time stored in this instance in the indicated unit.
Definition at line 314 of file nstime.h.
References H, and ToDouble().
|
inline |
Definition at line 360 of file nstime.h.
References GetTimeStep().
Referenced by ns3::DistributedSimulatorImpl::CalculateLookAhead(), TimeSimpleTestCase::DoRun(), ns3::NullMessageMpiInterface::SendNullMessage(), ns3::GrantedTimeWindowMpiInterface::SendPacket(), and ns3::NullMessageMpiInterface::SendPacket().
|
inline |
Get an approximation of the time stored in this instance in the indicated unit.
Definition at line 330 of file nstime.h.
References ToInteger(), and US.
Referenced by ns3::dot11s::IeBeaconTiming::BeaconIntervalToU16(), ns3::WifiRemoteStationInfo::CalculateAveragingCoefficient(), CoDelQueueBasicDrop::Dequeue(), ns3::ApWifiMac::DoInitialize(), ns3::dot11s::HwmpProtocol::GetActivePathLifetime(), ns3::NscTcpL4Protocol::gettime(), Ns3TcpStateTestCase::Ipv4L3Tx(), Ns3TcpLossTestCase::Ipv4L3Tx(), Ns3TcpInteroperabilityTestCase::Ipv4L3Tx(), ns3::LrWpanCsmaCa::RandomBackoffDelay(), ns3::MeshWifiInterfaceMac::Receive(), ns3::dot11s::HwmpProtocol::ReceivePreq(), ns3::MeshWifiInterfaceMac::SendBeacon(), ns3::ApWifiMac::SendOneBeacon(), ns3::dot11s::HwmpProtocol::SendProactivePreq(), ns3::ApWifiMac::SendProbeResp(), ns3::dot11s::PeerLink::SetBeaconInformation(), ns3::ApWifiMac::SetBeaconInterval(), ns3::dot11s::PeerLink::SetConfirmTimer(), ns3::WifiMacHeader::SetDuration(), ns3::dot11s::PeerLink::SetHoldingTimer(), ns3::dot11s::PeerLink::SetRetryTimer(), ns3::DcfManager::SetSlot(), ns3::dot11s::IeBeaconTiming::TimestampToU16(), ns3::dot11s::PeerManagementProtocol::TimeToTu(), ns3::MinstrelWifiManager::UpdateStats(), and ns3::PcapFileWrapper::Write().
|
inline |
Get an approximation of the time stored in this instance in the indicated unit.
Definition at line 326 of file nstime.h.
References MS, and ToInteger().
Referenced by ns3::TraceFadingLossModel::DoCalcRxPowerSpectralDensity(), ns3::A3RsrpHandoverAlgorithm::DoInitialize(), ns3::LteRlcTm::DoReportBufferStatus(), ns3::LteRlcUm::DoReportBufferStatus(), ns3::LteRlcAm::DoReportBufferStatus(), RttTestCase::DoRun(), LenaDataPhyErrorModelTestCase::DoRun(), LenaDlCtrlPhyErrorModelTestCase::DoRun(), LteUeMeasurementsHandoverTestCase::DoRun(), ns3::TcpOptionTS::ElapsedTimeFromTsValue(), ns3::LteSpectrumPhy::EndRxData(), LteHandoverTargetTestCase::HandoverStartCallback(), ns3::TraceFadingLossModel::LoadTrace(), JakesPropagationExample::Next(), ns3::TcpOptionTS::NowToTsValue(), ns3::V4Ping::Receive(), ns3::LteUePhy::ReceiveLteControlMessageList(), LteUeMeasurementsPiecewiseTestCase1::RecvMeasurementReportCallback(), LteUeMeasurementsPiecewiseTestCase2::RecvMeasurementReportCallback(), LteUeMeasurementsHandoverTestCase::RecvMeasurementReportCallback(), ns3::aodv::RrepHeader::RrepHeader(), ns3::aodv::RrepHeader::SetHello(), ns3::aodv::RrepHeader::SetLifeTime(), and ns3::LteEnbPhy::StartSubFrame().
|
inline |
Get an approximation of the time stored in this instance in the indicated unit.
Definition at line 318 of file nstime.h.
References MIN, and ToDouble().
|
inline |
Get an approximation of the time stored in this instance in the indicated unit.
Definition at line 334 of file nstime.h.
References NS, and ToInteger().
Referenced by ns3::AcousticModemEnergyModel::ChangeState(), ns3::WifiRadioEnergyModel::ChangeState(), ns3::CoDelGetTime(), ns3::MacStatsCalculator::DlScheduling(), ns3::LteRlcTm::DoReceivePdu(), ns3::LteRlcUm::DoReceivePdu(), ns3::LteRlcAm::DoReceivePdu(), ns3::LtePdcp::DoReceivePdu(), ns3::LteRlcSm::DoReceivePdu(), TimeSimpleTestCase::DoRun(), OcbWifiMacTestCase::DoRun(), TimeIntputOutputTestCase::DoRun(), OcbWifiMacTestCase::MacAssoc(), SimulatorEventsTestCase::NowUs(), OcbWifiMacTestCase::PhyRxOkTrace(), OcbWifiMacTestCase::PhyTxTrace(), ns3::PhyStatsCalculator::ReportCurrentCellRsrpSinr(), ns3::PhyStatsCalculator::ReportInterference(), ns3::PhyStatsCalculator::ReportUeSinr(), ns3::RlcTag::Serialize(), ns3::PdcpTag::Serialize(), TimestampTag::Serialize(), ns3::CoDelQueue::Time2CoDel(), ns3::Synchronizer::TimeStepToNanosecond(), ns3::MacStatsCalculator::UlScheduling(), ns3::BasicEnergyHarvester::UpdateHarvestedPower(), ns3::RadioBearerStatsCalculator::WriteDlResults(), and ns3::RadioBearerStatsCalculator::WriteUlResults().
|
inline |
Get an approximation of the time stored in this instance in the indicated unit.
Definition at line 338 of file nstime.h.
References PS, and ToInteger().
|
static |
Definition at line 378 of file time.cc.
References PeekResolution(), and ns3::Time::Resolution::unit.
Referenced by ns3::operator<<().
|
inline |
Get an approximation of the time stored in this instance in the indicated unit.
Definition at line 322 of file nstime.h.
References S, and ToDouble().
Referenced by ns3::dsr::RouteCache::AddRoute_Link(), ns3::AsciiLrWpanMacTransmitSinkWithContext(), ns3::AsciiLrWpanMacTransmitSinkWithoutContext(), ns3::AsciiPhyReceiveSinkWithContext(), ns3::AsciiPhyReceiveSinkWithoutContext(), ns3::AsciiPhyRxOkEvent(), ns3::AsciiPhyTransmitSinkWithContext(), ns3::AsciiPhyTransmitSinkWithoutContext(), ns3::AsciiPhyTxEvent(), ns3::WimaxHelper::AsciiRxEvent(), ns3::WimaxHelper::AsciiTxEvent(), ns3::UanPhyCalcSinrFhFsk::CalcSinrDb(), ns3::InterferenceHelper::CalculateChunkSuccessRate(), ns3::SimpleOfdmWimaxPhy::CalculateDataRate(), ns3::BasicEnergySource::CalculateRemainingEnergy(), ns3::LiIonEnergySource::CalculateRemainingEnergy(), ns3::LteUeRrc::CancelEnteringTrigger(), ns3::LteUeRrc::CancelLeavingTrigger(), ns3::AcousticModemEnergyModel::ChangeState(), ns3::WifiRadioEnergyModel::ChangeState(), CheckQueueSize(), LteX2HandoverMeasuresTestCase::CheckStats(), LteX2HandoverTestCase::CheckStatsAWhileAfterHandover(), ns3::UanMacRcGw::ComputeAlpha(), ns3::UanMacRcGw::ComputeExpS(), BatteryLifetimeTest::ConstantLoadTest(), Ns2MobilityHelperTest::CourseChange(), WaypointMobilityModelNotifyTest::CourseChangeCallback(), ns3::AnimationInterface::CsmaPhyTxEndTrace(), CwndChange(), CwndTracer(), Ns3TcpLossTestCase::CwndTracer(), ns3::AsciiTraceHelper::DefaultDequeueSinkWithContext(), ns3::AsciiTraceHelper::DefaultDequeueSinkWithoutContext(), ns3::AsciiTraceHelper::DefaultDropSinkWithContext(), ns3::AsciiTraceHelper::DefaultDropSinkWithoutContext(), ns3::AsciiTraceHelper::DefaultEnqueueSinkWithContext(), ns3::AsciiTraceHelper::DefaultEnqueueSinkWithoutContext(), ns3::AsciiTraceHelper::DefaultReceiveSinkWithContext(), ns3::AsciiTraceHelper::DefaultReceiveSinkWithoutContext(), ns3::AnimationInterface::DevTxTrace(), ns3::TraceFadingLossModel::DoCalcRxPowerSpectralDensity(), ns3::SimpleOfdmWimaxPhy::DoGetFrameDurationCode(), ns3::SimpleOfdmWimaxPhy::DoGetNrBytes(), ns3::SimpleOfdmWimaxPhy::DoGetNrSymbols(), ns3::dot11s::HwmpProtocol::DoInitialize(), ns3::MeshWifiInterfaceMac::DoInitialize(), ns3::RipNg::DoInitialize(), TimesWithSignsTestCase::DoRun(), ns3::SimpleOfdmWimaxPhy::DoSetPhyParameters(), ns3::RandomWalk2dMobilityModel::DoWalk(), ns3::GaussMarkovMobilityModel::DoWalk(), DroppingStateTracer(), ns3::TcpWestwood::DupAck(), LteHandoverDelayTestCase::EnbHandoverEndOkCallback(), ns3::LteTestSinrChunkProcessor::End(), ns3::LteChunkProcessor::End(), ns3::BaseStationNetDevice::EndDlSubFrame(), ns3::BaseStationNetDevice::EndUlSubFrame(), ns3::UanMacCw::Enqueue(), ns3::TcpWestwood::EstimateBW(), ns3::LteTestSinrChunkProcessor::EvaluateChunk(), ns3::ShannonSpectrumErrorModel::EvaluateChunk(), ns3::LteChunkProcessor::EvaluateChunk(), EveryDropTracer(), ExampleFunction(), ns3::dsr::RouteCache::FindSameRoute(), ns3::SpectrumAnalyzer::GenerateReport(), GenerateTraffic(), ns3::UanMacRcGw::GetExpPdk(), ns3::dsdv::RoutingProtocol::GetSettlingTime(), ns3::JakesProcess::Oscillator::GetValueAt(), MyModel::HandleEvent(), Ipv4DynamicGlobalRoutingTestCase::HandleRead(), HarvestedPower(), ns3::dsr::RouteCache::IncStability(), ns3::RedQueue::InitializeParams(), ns3::SubscriberStationNetDevice::InitSubscriberStationNetDevice(), ns3::aodv::RoutingTableEntry::Invalidate(), ns3::Ipv4L3ProtocolDropSinkWithContext(), ns3::Ipv4L3ProtocolDropSinkWithoutContext(), ns3::Ipv4L3ProtocolRxSinkWithContext(), ns3::Ipv4L3ProtocolRxSinkWithoutContext(), ns3::Ipv4L3ProtocolTxSinkWithContext(), ns3::Ipv4L3ProtocolTxSinkWithoutContext(), ns3::Ipv6L3ProtocolDropSinkWithContext(), ns3::Ipv6L3ProtocolDropSinkWithoutContext(), ns3::Ipv6L3ProtocolRxSinkWithContext(), ns3::Ipv6L3ProtocolRxSinkWithoutContext(), ns3::Ipv6L3ProtocolTxSinkWithContext(), ns3::Ipv6L3ProtocolTxSinkWithoutContext(), ns3::ArpCache::Entry::IsExpired(), ns3::olsr::RoutingProtocol::LinkSensing(), main(), ns3::aodv::RoutingTable::MarkLinkAsUnidirectional(), ns3::BaseStationNetDevice::MarkUplinkAllocations(), modify(), NotifyConnectionEstablishedEnb(), NotifyConnectionEstablishedUe(), NotifyHandoverEndOkEnb(), NotifyHandoverEndOkUe(), NotifyHandoverStartEnb(), NotifyHandoverStartUe(), ns3::UanMacCw::NotifyTxStart(), ns3::CoDelQueue::OkToDrop(), ns3::operator*(), ns3::operator<<(), LrWpanCcaTestCase::PhyRxBegin(), LrWpanCcaTestCase::PhyRxDrop(), LrWpanCcaTestCase::PhyRxEnd(), PhyStateTrace(), LrWpanCcaTestCase::PhyTxBegin(), LrWpanCcaTestCase::PhyTxEnd(), LrWpanCcaTestCase::PlmeCcaConfirm(), ns3::SeqTsHeader::Print(), ns3::UanHeaderRcData::Print(), ns3::dsdv::RoutingTableEntry::Print(), ns3::UanHeaderRcRts::Print(), ns3::UanHeaderRcCtsGlobal::Print(), ns3::UanHeaderRcCts::Print(), PrintCellInfo(), IpAddressHelper::PrintIpAddresses(), PrintReceivedPacket(), ns3::dsdv::RoutingProtocol::PrintRoutingTable(), ns3::aodv::RoutingProtocol::PrintRoutingTable(), ns3::Ipv4ListRouting::PrintRoutingTable(), ns3::Ipv6ListRouting::PrintRoutingTable(), ns3::RipNg::PrintRoutingTable(), ns3::Ipv6StaticRouting::PrintRoutingTable(), ns3::UplinkSchedulerMBQoS::ProcessBandwidthRequest(), ns3::AnimationInterface::AnimPacketInfo::ProcessRxEnd(), ns3::AnimationInterface::PurgePendingPackets(), RandomFunction(), ns3::UanMacRc::ReceiveOkFromPhy(), ns3::dsdv::RoutingProtocol::RecvDsdv(), RemainingEnergy(), RemainingEnergyTrace(), ns3::dot11s::HwmpProtocol::Report(), ns3::flame::FlameProtocol::Report(), ns3::dot11s::PeerLink::Report(), ns3::MeshWifiInterfaceMac::Report(), ns3::MeshHelper::Report(), ns3::FlowMonitor::ReportLastRx(), SampleEmitter::Reschedule(), NetAnimExperiment::ResetData(), Experiment::ResetData(), ns3::TcpWestwood::Retransmit(), ns3::RttMeanDeviation::RetransmitTimeout(), ns3::RttEstimator::RttEstimator(), ns3::RvBatteryModel::RvModelAFunction(), ns3::UanMacRc::ScheduleData(), ns3::dsr::DsrRouting::ScheduleNetworkPacketRetry(), ns3::dsr::DsrRouting::ScheduleRreqRetry(), ns3::Icmpv6L4Protocol::SendNS(), ns3::aodv::RoutingProtocol::SendRerrMessage(), ns3::aodv::RoutingProtocol::SendRerrWhenNoRouteToForward(), ns3::RipNg::SendTriggeredRouteUpdate(), ns3::RipNg::SendUnsolicitedRouteUpdate(), ns3::UanHeaderRcData::Serialize(), ns3::UanHeaderRcRts::Serialize(), ns3::UanHeaderRcCtsGlobal::Serialize(), ns3::UanHeaderRcCts::Serialize(), ns3::dot11s::PeerLink::SetBeaconInformation(), ns3::SimpleDeviceEnergyModel::SetCurrentA(), ns3::olsr::MessageHeader::Hello::SetHTime(), ns3::PointToPointNetDevice::SetInterframeGap(), ns3::UanPdp::SetTap(), ns3::olsr::MessageHeader::SetVTime(), showPosition(), Ipv4DynamicGlobalRoutingTestCase::SinkRx(), SocketPrinter(), SsThreshTracer(), ns3::dsr::DsrRouting::Start(), ns3::UanMacRcGw::StartCycle(), ns3::BaseStationNetDevice::StartDlSubFrame(), Ns3TcpStateTestCase::StartFlow(), Ns3TcpLossTestCase::StartFlow(), ns3::BaseStationNetDevice::StartFrame(), ns3::UanMacCw::StartTimer(), ns3::BaseStationNetDevice::StartUlSubFrame(), StateChangeNotification(), ns3::UanPdp::SumTapsC(), ns3::UanPdp::SumTapsFromMaxC(), ns3::UanPdp::SumTapsFromMaxNc(), ns3::UanPdp::SumTapsNc(), TestDeterministicByTime(), ns3::TimePrinter(), TotalEnergy(), TotalEnergyHarvested(), ns3::CsmaNetDevice::TransmitCompleteEvent(), ns3::CsmaChannel::TransmitEnd(), ns3::PointToPointNetDevice::TransmitStart(), ns3::CsmaNetDevice::TransmitStart(), LteHandoverDelayTestCase::UeHandoverEndOkCallback(), ns3::ConstantVelocityHelper::Update(), ns3::BasicEnergyHarvester::UpdateHarvestedPower(), BatteryLifetimeTest::VariableLoadTest(), ns3::WriteAveragePowerSpectralDensityReport(), Ns3TcpStateTestCase::WriteUntilBufferFull(), and Ns3TcpLossTestCase::WriteUntilBufferFull().
|
inline |
Definition at line 352 of file nstime.h.
References m_data.
Referenced by ns3::LrWpanPhy::EndEd(), ns3::LrWpanPhy::EndRx(), ns3::WaveformGenerator::GenerateWaveform(), GetInteger(), ns3::Radvd::HandleRead(), ns3::Synchronizer::NanosecondToTimeStep(), ns3::DistributedSimulatorImpl::NextTs(), ns3::OmnetDataOutput::OmnetOutputCallback::OutputSingleton(), ns3::SqliteDataOutput::SqliteOutputCallback::OutputSingleton(), ns3::RealtimeSimulatorImpl::ProcessOneEvent(), ns3::DefaultSimulatorImpl::Schedule(), ns3::NullMessageSimulatorImpl::Schedule(), ns3::RealtimeSimulatorImpl::Schedule(), ns3::DistributedSimulatorImpl::Schedule(), ns3::RealtimeSimulatorImpl::ScheduleRealtimeWithContext(), ns3::DefaultSimulatorImpl::ScheduleWithContext(), ns3::NullMessageSimulatorImpl::ScheduleWithContext(), ns3::RealtimeSimulatorImpl::ScheduleWithContext(), ns3::DistributedSimulatorImpl::ScheduleWithContext(), ns3::NullMessageMpiInterface::SendNullMessage(), ns3::GrantedTimeWindowMpiInterface::SendPacket(), ns3::NullMessageMpiInterface::SendPacket(), ns3::LrWpanPhy::StartRx(), ns3::DefaultSimulatorImpl::Stop(), ns3::NullMessageSimulatorImpl::Stop(), and ns3::DistributedSimulatorImpl::Stop().
|
inline |
Get an approximation of the time stored in this instance in the indicated unit.
Definition at line 306 of file nstime.h.
References ToDouble(), and Y.
|
inline |
|
inline |
Definition at line 274 of file nstime.h.
References m_data.
Referenced by ns3::DefaultSimulatorImpl::Schedule(), and ns3::RealtimeSimulatorImpl::Schedule().
|
inline |
|
inline |
|
inline |
Definition at line 264 of file nstime.h.
References m_data.
Referenced by main(), and ns3::YansWifiPhy::StartReceivePacket().
|
staticprivate |
Record a Time instance with the MarkedTimes.
[in] | time | The Time instance to record. |
Definition at line 285 of file time.cc.
References g_markingTimes, GetMarkingMutex(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, and NS_LOG_WARN.
Referenced by Time().
|
inlinestatic |
Maximum representable Time.
Definition at line 249 of file nstime.h.
References Time().
Referenced by ns3::MakeTimeChecker().
|
inlinestatic |
Minimum representable Time.
Definition at line 244 of file nstime.h.
References Time().
Referenced by ns3::MakeTimeChecker().
|
inline |
|
inlinestaticprivate |
Get the Information record for timeUnit
for the current Resolution.
[in] | timeUnit | The Unit to get Information for |
timeUnit
Definition at line 532 of file nstime.h.
References ns3::Time::Resolution::info, and PeekResolution().
Referenced by From(), FromInteger(), To(), and ToInteger().
|
inlinestaticprivate |
Get the current Resolution.
Definition at line 521 of file nstime.h.
References SetDefaultNsResolution().
Referenced by GetResolution(), PeekInformation(), and SetResolution().
|
staticprivate |
Set the default resolution.
Definition at line 168 of file time.cc.
References NS, NS_LOG_FUNCTION_NOARGS, and SetResolution().
Referenced by PeekResolution().
|
static |
resolution | the new resolution to use |
Change the global resolution used to convert all user-provided time values in Time objects and Time objects in user-expected time units.
Definition at line 178 of file time.cc.
References NS_LOG_FUNCTION, and PeekResolution().
Referenced by main(), and SetDefaultNsResolution().
|
staticprivate |
Set the current Resolution.
[in] | unit | The unit to use as the new resolution. |
[in,out] | resolution | The Resolution record to update. |
[in] | convert | Whether to convert existing Time objects to the new resolution. |
Definition at line 187 of file time.cc.
References ConvertTimes(), ns3::Time::Information::factor, ns3::Time::Information::fromMul, ns3::Time::Resolution::info, ns3::int64x64_t::Invert(), LAST, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Time::Information::timeFrom, ns3::Time::Information::timeTo, ns3::Time::Information::toMul, and ns3::Time::Resolution::unit.
|
static |
Function to force static initialization of Time.
Definition at line 61 of file time.cc.
References g_markingTimes, GetMarkingMutex(), and NS_LOG_ERROR.
|
inline |
Get the Time value expressed in a particular unit.
[in] | unit | The desired unit |
unit
Definition at line 460 of file nstime.h.
References m_data, ns3::int64x64_t::MulByInvert(), PeekInformation(), ns3::Time::Information::timeTo, and ns3::Time::Information::toMul.
Referenced by ns3::OnOffApplication::CancelEvents(), ns3::operator<<(), and ToDouble().
|
inline |
Get the Time value expressed in a particular unit.
[in] | unit | The desired unit |
unit
Definition at line 456 of file nstime.h.
References ns3::int64x64_t::GetDouble(), and To().
Referenced by GetDays(), GetHours(), GetMinutes(), GetSeconds(), GetYears(), and ns3::RttMeanDeviation::Measurement().
|
inline |
Get the Time value expressed in a particular unit.
[in] | unit | The desired unit |
unit
Definition at line 442 of file nstime.h.
References ns3::Time::Information::factor, m_data, PeekInformation(), and ns3::Time::Information::toMul.
Referenced by ConvertTimes(), GetFemtoSeconds(), GetMicroSeconds(), GetMilliSeconds(), GetNanoSeconds(), GetPicoSeconds(), and ns3::RttMeanDeviation::RetransmitTimeout().
|
related |
Definition at line 52 of file time.cc.
Referenced by Clear(), ClearMarkedTimes(), ConvertTimes(), Mark(), and StaticInit().
|
staticprivate |
Record of outstanding Time objects which will need conversion when the resolution is set.
Use a classic static variable so we can check in Time ctors without a function call.
We'd really like to initialize this here, but we don't want to require C++0x, so we init in time.cc. To ensure that happens before first use, we add a call to StaticInit (below) to every compilation unit which includes nstime.h.
Definition at line 587 of file nstime.h.
Referenced by Clear(), ClearMarkedTimes(), ConvertTimes(), Mark(), StaticInit(), Time(), and ~Time().
|
private |
Virtual time value, in the current unit.
Definition at line 668 of file nstime.h.
Referenced by ns3::Abs(), Compare(), ConvertTimes(), GetDouble(), GetTimeStep(), IsNegative(), IsPositive(), IsStrictlyNegative(), IsStrictlyPositive(), IsZero(), ns3::Max(), ns3::Min(), operator int64x64_t(), ns3::operator!=(), ns3::operator*(), ns3::operator+(), ns3::operator+=(), ns3::operator-(), ns3::operator-=(), ns3::operator/(), ns3::operator<(), ns3::operator<=(), operator=(), ns3::operator==(), ns3::operator>(), ns3::operator>=(), To(), and ToInteger().