A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::Time Class Reference

Simulation virtual time values and global simulation resolution. More...

#include "nstime.h"

+ Collaboration diagram for ns3::Time:

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

typedef void(* TracedCallback) (Time value)
 TracedCallback signature for Time.
 
enum  Unit {
  Y = 0 , D = 1 , H = 2 , MIN = 3 ,
  S = 4 , MS = 5 , US = 6 , NS = 7 ,
  PS = 8 , FS = 9 , LAST = 10 , AUTO = 11
}
 The unit to use to interpret a number representing time. More...
 

Public Member Functions

 Time ()
 Default constructor, with value 0.
 
 Time (const std::string &s)
 Construct Time object from common time expressions like "1ms".
 
 Time (const Time &o)
 Copy constructor.
 
 Time (Time &&o)
 Move constructor.
 
 ~Time ()
 Destructor.
 
TimeWithUnit As (const Unit unit=Time::AUTO) const
 Attach a unit to a Time, to facilitate output in a specific unit.
 
int Compare (const Time &o) const
 Compare this to another Time.
 
bool IsNegative () const
 Exactly equivalent to t <= 0.
 
bool IsPositive () const
 Exactly equivalent to t >= 0.
 
bool IsStrictlyNegative () const
 Exactly equivalent to t < 0.
 
bool IsStrictlyPositive () const
 Exactly equivalent to t > 0.
 
bool IsZero () const
 Exactly equivalent to t == 0.
 
Timeoperator= (const Time &o)
 Assignment operator.
 
Time RoundTo (Unit unit) const
 Round a Time to a specific unit.
 
Numeric constructors

Construct from a numeric value.

 Time (double v)
 Construct from a numeric value.
 
 Time (int v)
 Construct from a numeric value.
 
 Time (long int v)
 Construct from a numeric value.
 
 Time (long long int v)
 Construct from a numeric value.
 
 Time (unsigned int v)
 Construct from a numeric value.
 
 Time (unsigned long int v)
 Construct from a numeric value.
 
 Time (unsigned long long int v)
 Construct from a numeric value.
 
 Time (const int64x64_t &v)
 Construct from a numeric value.
 
Convert to Number in a Unit

Convert a Time to number, in indicated units.

Conversions to seconds and larger will return doubles, with possible loss of precision. Conversions to units smaller than seconds will be rounded.

double GetYears () const
 Get an approximation of the time stored in this instance in the indicated unit.
 
double GetDays () const
 Get an approximation of the time stored in this instance in the indicated unit.
 
double GetHours () const
 Get an approximation of the time stored in this instance in the indicated unit.
 
double GetMinutes () const
 Get an approximation of the time stored in this instance in the indicated unit.
 
double GetSeconds () const
 Get an approximation of the time stored in this instance in the indicated unit.
 
int64_t GetMilliSeconds () const
 Get an approximation of the time stored in this instance in the indicated unit.
 
int64_t GetMicroSeconds () const
 Get an approximation of the time stored in this instance in the indicated unit.
 
int64_t GetNanoSeconds () const
 Get an approximation of the time stored in this instance in the indicated unit.
 
int64_t GetPicoSeconds () const
 Get an approximation of the time stored in this instance in the indicated unit.
 
int64_t GetFemtoSeconds () const
 Get an approximation of the time stored in this instance in the indicated unit.
 
Convert to Raw Value

Convert a Time to a number in the current resolution units.

int64_t GetTimeStep () const
 Get the raw time value, in the current resolution unit.
 
double GetDouble () const
 Get the raw time value, in the current resolution unit.
 
int64_t GetInteger () const
 Get the raw time value, in the current resolution unit.
 
Get Times as Numbers in Specified Units

Get the Time as integers or doubles in the indicated unit.

int64_t ToInteger (Unit unit) const
 Get the Time value expressed in a particular unit.
 
double ToDouble (Unit unit) const
 Get the Time value expressed in a particular unit.
 
int64x64_t To (Unit unit) const
 Get the Time value expressed in a particular unit.
 

Static Public Member Functions

static Time From (const int64x64_t &value)
 Create a Time in the current unit.
 
static Unit GetResolution ()
 
static Time Max ()
 Maximum representable Time Not to be confused with Max(Time,Time).
 
static Time Min ()
 Minimum representable Time Not to be confused with Min(Time,Time).
 
static void SetResolution (Unit resolution)
 
static bool StaticInit ()
 Function to force static initialization of Time.
 
Create Times from Values and Units

Create Times from values given in the indicated units.

static Time FromInteger (uint64_t value, Unit unit)
 Create a Time equal to value in unit unit.
 
static Time FromDouble (double value, Unit unit)
 Create a Time equal to value in unit unit.
 
static Time From (const int64x64_t &value, Unit unit)
 Create a Time equal to value in unit unit.
 

Private Types

typedef std::set< Time * > MarkedTimes
 Record all instances of Time, so we can rescale them when the resolution changes.
 

Static Private Member Functions

static void Clear (Time *const time)
 Remove a Time instance from the MarkedTimes, called by ~Time().
 
static void ClearMarkedTimes ()
 Remove all MarkedTimes.
 
static void ConvertTimes (const Unit unit)
 Convert existing Times to the new unit.
 
static void Mark (Time *const time)
 Record a Time instance with the MarkedTimes.
 
static InformationPeekInformation (Unit timeUnit)
 Get the Information record for timeUnit for the current Resolution.
 
static ResolutionPeekResolution ()
 Get the current Resolution.
 
static ResolutionSetDefaultNsResolution ()
 Set the default resolution.
 
static void SetResolution (Unit unit, Resolution *resolution, const bool convert=true)
 Set the current Resolution.
 

Private Attributes

int64_t m_data
 Virtual time value, in the current unit.
 

Static Private Attributes

static MarkedTimesg_markingTimes = nullptr
 Record of outstanding Time objects which will need conversion when the resolution is set.
 

Friends

template<class T >
std::enable_if_t< std::is_floating_point_v< T >, Timeoperator* (const Time &lhs, T rhs)
 Scale a Time by an integer value.
 
template<class T >
std::enable_if_t< std::is_floating_point_v< T >, Timeoperator/ (const Time &lhs, T rhs)
 Divide a Time by an integer value.
 
Comparison operators
bool operator== (const Time &lhs, const Time &rhs)
 Equality operator for Time.
 
bool operator!= (const Time &lhs, const Time &rhs)
 Inequality operator for Time.
 
bool operator<= (const Time &lhs, const Time &rhs)
 Less than or equal operator for Time.
 
bool operator>= (const Time &lhs, const Time &rhs)
 Greater than or equal operator for Time.
 
bool operator< (const Time &lhs, const Time &rhs)
 Less than operator for Time.
 
bool operator> (const Time &lhs, const Time &rhs)
 Greater than operator for Time.
 
bool operator< (const Time &time, const EventId &event)
 Compare a Time to an EventId.
 
Arithmetic operators
Time operator+ (const Time &lhs, const Time &rhs)
 Addition operator for Time.
 
Time operator- (const Time &lhs, const Time &rhs)
 Subtraction operator for Time.
 
Time operator* (const Time &lhs, const int64x64_t &rhs)
 Scale a Time by a numeric value.
 
Time operator* (const int64x64_t &lhs, const Time &rhs)
 Scale a Time by a numeric value.
 
int64x64_t operator/ (const Time &lhs, const Time &rhs)
 Exact division, returning a dimensionless fixed point number.
 
Time operator/ (const Time &lhs, const int64x64_t &rhs)
 Scale a Time by a numeric value.
 
Time operator% (const Time &lhs, const Time &rhs)
 Remainder (modulus) from the quotient of two Times.
 
int64_t Div (const Time &lhs, const Time &rhs)
 Integer quotient from dividing two Times.
 
Time Rem (const Time &lhs, const Time &rhs)
 Addition operator for Time.
 
template<class T >
std::enable_if_t< std::is_integral_v< T >, Timeoperator* (const Time &lhs, T rhs)
 Scale a Time by an integer value.
 
template<class T >
std::enable_if_t< std::is_arithmetic_v< T >, Timeoperator* (T lhs, const Time &rhs)
 Scale a Time by a numeric value.
 
template<class T >
std::enable_if_t< std::is_integral_v< T >, Timeoperator/ (const Time &lhs, T rhs)
 Divide a Time by an integer value.
 
Time Abs (const Time &time)
 Absolute value for Time.
 
Time Max (const Time &timeA, const Time &timeB)
 Maximum of two Times.
 
Time Min (const Time &timeA, const Time &timeB)
 Minimum of two Times.
 
Compound assignment operators
Timeoperator+= (Time &lhs, const Time &rhs)
 Compound addition assignment for Time.
 
Timeoperator-= (Time &lhs, const Time &rhs)
 Compound subtraction assignment for Time.
 

Related Symbols

(Note that these are not member symbols.)

Time TimeStep (uint64_t ts)
 Scheduler interface.
 

Detailed Description

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, subtract, or compare Time objects.

For example:

Time t1 = Seconds (10.0);
Time t2 = Seconds (10.0);
Time t3 = t1;
t3 += t2;
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308

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 representation. 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 maximum simulation duration. The global simulation time is stored in a 64 bit integer whose interpretation will depend on the global resolution. Therefore the maximum possible 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.

Definition at line 93 of file nstime.h.

Member Typedef Documentation

◆ MarkedTimes

typedef std::set<Time*> ns3::Time::MarkedTimes
private

Record all instances of Time, so we can rescale them when the resolution changes.

Internal:

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.

Definition at line 696 of file nstime.h.

◆ TracedCallback

typedef void(* ns3::Time::TracedCallback) (Time value)

TracedCallback signature for Time.

Parameters
[in]valueCurrent value of Time

Definition at line 618 of file nstime.h.

Member Enumeration Documentation

◆ Unit

The unit to use to interpret a number representing time.

Enumerator

year, 365 days

day, 24 hours

hour, 60 minutes

MIN 

minute, 60 seconds

second

MS 

millisecond

US 

microsecond

NS 

nanosecond

PS 

picosecond

FS 

femtosecond

LAST 

marker for last normal value

AUTO 

auto-scale output when using Time::As()

Definition at line 99 of file nstime.h.

Constructor & Destructor Documentation

◆ Time() [1/12]

ns3::Time::Time ( )
inline

Default constructor, with value 0.

Definition at line 127 of file nstime.h.

References g_markingTimes, and Mark().

Referenced by From(), From(), FromInteger(), Max(), and Min().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Time() [2/12]

ns3::Time::Time ( const Time & o)
inline

Copy constructor.

Parameters
[in]oTime to copy

Definition at line 141 of file nstime.h.

References g_markingTimes, and Mark().

+ Here is the call graph for this function:

◆ Time() [3/12]

ns3::Time::Time ( Time && o)
inline

Move constructor.

Parameters
[in]oTime from which take the data

Definition at line 155 of file nstime.h.

References g_markingTimes, and Mark().

+ Here is the call graph for this function:

◆ Time() [4/12]

ns3::Time::Time ( double v)
inlineexplicit

Construct from a numeric value.

The current time resolution will be assumed as the unit.

Parameters
[in]vThe value.

Definition at line 174 of file nstime.h.

References g_markingTimes, and Mark().

+ Here is the call graph for this function:

◆ Time() [5/12]

ns3::Time::Time ( int v)
inlineexplicit

Construct from a numeric value.

The current time resolution will be assumed as the unit.

Parameters
[in]vThe value.

Definition at line 183 of file nstime.h.

References g_markingTimes, and Mark().

+ Here is the call graph for this function:

◆ Time() [6/12]

ns3::Time::Time ( long int v)
inlineexplicit

Construct from a numeric value.

The current time resolution will be assumed as the unit.

Parameters
[in]vThe value.

Definition at line 192 of file nstime.h.

References g_markingTimes, and Mark().

+ Here is the call graph for this function:

◆ Time() [7/12]

ns3::Time::Time ( long long int v)
inlineexplicit

Construct from a numeric value.

The current time resolution will be assumed as the unit.

Parameters
[in]vThe value.

Definition at line 201 of file nstime.h.

References g_markingTimes, and Mark().

+ Here is the call graph for this function:

◆ Time() [8/12]

ns3::Time::Time ( unsigned int v)
inlineexplicit

Construct from a numeric value.

The current time resolution will be assumed as the unit.

Parameters
[in]vThe value.

Definition at line 210 of file nstime.h.

References g_markingTimes, and Mark().

+ Here is the call graph for this function:

◆ Time() [9/12]

ns3::Time::Time ( unsigned long int v)
inlineexplicit

Construct from a numeric value.

The current time resolution will be assumed as the unit.

Parameters
[in]vThe value.

Definition at line 219 of file nstime.h.

References g_markingTimes, and Mark().

+ Here is the call graph for this function:

◆ Time() [10/12]

ns3::Time::Time ( unsigned long long int v)
inlineexplicit

Construct from a numeric value.

The current time resolution will be assumed as the unit.

Parameters
[in]vThe value.

Definition at line 228 of file nstime.h.

References g_markingTimes, and Mark().

+ Here is the call graph for this function:

◆ Time() [11/12]

ns3::Time::Time ( const int64x64_t & v)
inlineexplicit

Construct from a numeric value.

The current time resolution will be assumed as the unit.

Parameters
[in]vThe value.

Definition at line 237 of file nstime.h.

References g_markingTimes, and Mark().

+ Here is the call graph for this function:

◆ Time() [12/12]

ns3::Time::Time ( const std::string & s)
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 must be no whitespace between the numerical portion and the unit. If the string only contains a number, it is treated as seconds. Any otherwise malformed string causes a fatal error to occur.

Parameters
[in]sThe string to parse into a Time

Definition at line 118 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.

+ Here is the call graph for this function:

◆ ~Time()

ns3::Time::~Time ( )
inline

Destructor.

Definition at line 292 of file nstime.h.

References Clear(), and g_markingTimes.

+ Here is the call graph for this function:

Member Function Documentation

◆ As()

TimeWithUnit ns3::Time::As ( const Unit unit = Time::AUTO) const

Attach a unit to a Time, to facilitate output in a specific unit.

For example,

Time t (3.14e9); // Pi seconds
std::cout << t.As (Time::MS) << std::endl;
@ MS
millisecond
Definition nstime.h:106

will print +3140.0ms

Parameters
[in]unitThe unit to use.
Returns
The Time with embedded unit.

Definition at line 404 of file time.cc.

Referenced by ns3::SixLowPanNetDevice::AddContext(), ThreeGppHttpClientServerTestSuite::AddHttpObjectTestCase(), ns3::dsr::DsrRouteCache::AddRoute_Link(), ns3::AsciiLrWpanMacTransmitSinkWithContext(), ns3::AsciiLrWpanMacTransmitSinkWithoutContext(), AssociateConfirm(), ns3::lrwpan::LrWpanCsmaCa::CanProceed(), TimeInputOutputTestCase::CheckAs(), EmlsrUlTxopTest::CheckBlockAck(), ns3::FlowMonitor::CheckForLostPackets(), ClientPageReceived(), ThreeGppHttpObjectTestCase::ClientRxDelayCallback(), ThreeGppHttpObjectTestCase::ClientRxRttCallback(), ns3::ThreeGppHttpServerTxBuffer::CloseAllSockets(), ns3::ThreeGppHttpServerTxBuffer::CloseSocket(), CommStatusIndication(), BatteryLifetimeTest::ConstantLoadTest(), CourseChangeCallback(), DataSentMacConfirm(), ns3::dsr::DsrRouteCache::DecStability(), ns3::DefaultTimePrinter(), ns3::TbfQueueDisc::DoDequeue(), ns3::A3RsrpHandoverAlgorithm::DoInitialize(), ns3::LteRlcSm::DoReceivePdu(), LrWpanSlottedCsmacaTestCase::DoRun(), LteHandoverDelayTestCase::DoRun(), LteRadioLinkFailureTestCase::DoRun(), LteRlcAmE2eTestCase::DoRun(), TimeInputOutputTestCase::DoRun(), ns3::RandomWalk2dMobilityModel::DoWalk(), ns3::RandomWalk2dMobilityModel::DrawRandomVelocityAndDistance(), ns3::EhtFrameExchangeManager::EmlsrSwitchToListening(), LteHandoverDelayTestCase::EnbHandoverEndOkCallback(), EnbRrcTimeout(), ns3::CommonInfoBasicMle::EncodeEmlsrPaddingDelay(), ns3::CommonInfoBasicMle::EncodeEmlsrTransitionDelay(), ns3::PhyEntity::EndOfMpdu(), ns3::UanMacCw::Enqueue(), ns3::ThreeGppHttpClient::EnterParsingTime(), ns3::ThreeGppHttpClient::EnterReadingTime(), ns3::dsr::DsrRouteCache::FindSameRoute(), ns3::dot11s::HwmpProtocol::ForwardPathError(), ns3::LteUePhy::GenerateCqiRsrpRsrq(), ns3::EhtFrameExchangeManager::GenerateInDeviceInterference(), ns3::ChannelAccessManager::GetAccessGrantStart(), ns3::ChannelAccessManager::GetBackoffEndFor(), ns3::ChannelAccessManager::GetBackoffStartFor(), ns3::CommandLineHelper::GetDefault< Time >(), ns3::ChannelAccessManager::GetLargestIdlePrimaryChannel(), ns3::PhyEntity::GetReceptionStatus(), ns3::dsdv::RoutingProtocol::GetSettlingTime(), ns3::lrwpan::LrWpanCsmaCa::GetTimeToNextSlot(), ns3::ShowProgress::GiveFeedback(), ns3::lrwpan::LrWpanMac::IfsWaitTimeout(), ns3::dsr::DsrRouteCache::IncStability(), ns3::aodv::RoutingTableEntry::Invalidate(), ns3::olsr::RoutingProtocol::LinkSensing(), ns3::aodv::RoutingTable::MarkLinkAsUnidirectional(), MoveNode(), JakesPropagationExample::Next(), ns3::HePhy::NotifyCcaBusy(), ns3::PhyEntity::NotifyCcaBusy(), NotifyConnectionEstablishedEnb(), NotifyConnectionEstablishedEnb(), NotifyConnectionEstablishedUe(), NotifyConnectionTimeoutUe(), NotifyHandoverEndOkEnb(), NotifyHandoverEndOkUe(), NotifyHandoverFailure(), NotifyHandoverStartEnb(), NotifyHandoverStartUe(), ns3::DefaultEmlsrManager::NotifyMainPhySwitch(), NotifyRandomAccessErrorUe(), NotifyRaResponseTimeoutUe(), ns3::EhtFrameExchangeManager::NotifySwitchingEmlsrLink(), ns3::StaWifiMac::NotifySwitchingEmlsrLink(), NotifyViaTraceSource(), ns3::operator<<(), OrphanIndication(), ns3::lrwpan::LrWpanMac::PdDataConfirm(), LrWpanCcaTestCase::PhyRxBegin(), LrWpanCcaTestCase::PhyRxDrop(), LrWpanCcaTestCase::PhyRxEnd(), PhySyncDetection(), LrWpanCcaTestCase::PhyTxBegin(), LrWpanCcaTestCase::PhyTxEnd(), LrWpanCcaTestCase::PlmeCcaConfirm(), PollConfirm(), ns3::dsdv::RoutingTableEntry::Print(), ns3::MgtEmlOmn::Print(), ns3::SeqTsEchoHeader::Print(), ns3::TcpTxItem::Print(), ns3::TimestampTag::Print(), ns3::UanHeaderRcCts::Print(), ns3::UanHeaderRcCtsGlobal::Print(), ns3::UanHeaderRcData::Print(), ns3::UanHeaderRcRts::Print(), PrintCellInfo(), PrintIntermediateTput(), ns3::Ipv6RoutingHelper::PrintNdiscCache(), ns3::Ipv6RoutingHelper::PrintNdiscCacheEvery(), ns3::lrwpan::LrWpanMac::PrintPendingTxQueue(), ns3::NixVectorRouting< T >::PrintRoutingPath(), ns3::aodv::RoutingProtocol::PrintRoutingTable(), ns3::dsdv::RoutingProtocol::PrintRoutingTable(), ns3::Ipv4GlobalRouting::PrintRoutingTable(), ns3::Ipv4ListRouting::PrintRoutingTable(), ns3::Ipv4StaticRouting::PrintRoutingTable(), ns3::Ipv6ListRouting::PrintRoutingTable(), ns3::Ipv6StaticRouting::PrintRoutingTable(), ns3::NixVectorRouting< T >::PrintRoutingTable(), ns3::olsr::RoutingProtocol::PrintRoutingTable(), ns3::Rip::PrintRoutingTable(), ns3::RipNg::PrintRoutingTable(), ns3::lrwpan::LrWpanMac::PrintTxQueue(), ns3::UplinkSchedulerMBQoS::ProcessBandwidthRequest(), ns3::lrwpan::LrWpanCsmaCa::RandomBackoffDelay(), ns3::RandomWalk2dMobilityModel::Rebound(), ns3::lrwpan::LrWpanMac::ReceiveBeacon(), ns3::ThreeGppHttpServer::ReceivedDataCallback(), ns3::AdvancedApEmlsrManager::ReceivedMacHdr(), ns3::AdvancedEmlsrManager::ReceivedMacHdr(), ns3::FrameExchangeManager::ReceivedMacHdr(), ns3::MeshPointDevice::ReceiveFromDevice(), ns3::HeFrameExchangeManager::ReceiveMuBarTrigger(), ns3::dot11s::HwmpProtocol::ReceivePrep(), ns3::dot11s::HwmpProtocol::ReceivePreq(), ns3::ThreeGppHttpServerTxBuffer::RecordNextServe(), ns3::dsdv::RoutingProtocol::RecvDsdv(), ns3::ThreeGppHttpServerTxBuffer::RemoveSocket(), ns3::SixLowPanNetDevice::RenewContext(), ns3::WifiTxTimer::Reschedule(), PingTestCase::RttTraceSink(), ns3::EhtFrameExchangeManager::RxStartIndication(), ns3::FrameExchangeManager::RxStartIndication(), ns3::HeFrameExchangeManager::RxStartIndication(), ScanConfirm(), ScanConfirm(), ScanConfirm(), ScanConfirm(), ns3::UanMacRc::ScheduleData(), ns3::PhyEntity::ScheduleEndOfMpdus(), ns3::OnOffApplication::ScheduleNextTx(), ns3::aodv::RoutingProtocol::ScheduleRreqRetry(), ns3::dsr::DsrRouting::ScheduleRreqRetry(), ns3::OnOffApplication::ScheduleStartEvent(), ns3::OnOffApplication::ScheduleStopEvent(), ns3::HeFrameExchangeManager::SendMultiStaBlockAck(), ns3::aodv::RoutingProtocol::SendRerrMessage(), ns3::aodv::RoutingProtocol::SendRerrWhenNoRouteToForward(), ns3::MultiUserScheduler::SetAccessReqInterval(), ns3::ThreeGppHttpHeader::SetClientTs(), ns3::ThreeGppHttpVariables::SetEmbeddedObjectGenerationDelay(), ns3::PointToPointNetDevice::SetInterframeGap(), ns3::ThreeGppHttpVariables::SetMainObjectGenerationDelay(), ns3::EmlsrManager::SetMediumSyncDuration(), ns3::ThreeGppHttpVariables::SetParsingTimeMean(), ns3::ThreeGppHttpVariables::SetReadingTimeMean(), ns3::ThreeGppHttpHeader::SetServerTs(), ns3::EmlsrManager::SetTransitionTimeout(), ns3::MultiLinkElement::SetTransitionTimeout(), ns3::TimeProbe::SetValue(), ns3::TimeProbe::SetValueByPath(), ns3::dsr::DsrRouting::Start(), ns3::FlowMonitor::Start(), ns3::WifiPhyRxTraceHelper::Start(), ns3::UanMacRcGw::StartCycle(), ns3::BaseStationNetDevice::StartDlSubFrame(), ns3::lrwpan::LrWpanMac::StartInactivePeriod(), ns3::HePhy::StartReceivePreamble(), ns3::SpectrumWifiPhy::StartRx(), ns3::UanMacCw::StartTimer(), ns3::BaseStationNetDevice::StartUlSubFrame(), StateChangeNotification(), TestRxOffWhenIdleAfterCsmaFailure::StateChangeNotificationDev0(), TestRxOffWhenIdleAfterCsmaFailure::StateChangeNotificationDev2(), ns3::FlowMonitor::Stop(), ns3::EmlsrManager::SwitchMainPhy(), Throughput(), ns3::TimeProbe::TraceSink(), ns3::CsmaNetDevice::TransmitCompleteEvent(), ns3::CsmaChannel::TransmitEnd(), ns3::CsmaNetDevice::TransmitStart(), ns3::PointToPointNetDevice::TransmitStart(), ns3::RrMultiUserScheduler::TrySendingBasicTf(), ns3::RrMultiUserScheduler::TrySendingBsrpTf(), LteHandoverDelayTestCase::UeHandoverEndOkCallback(), UeStateTransition(), UpdateAnimation(), ns3::RrMultiUserScheduler::UpdateCredits(), ns3::EhtFrameExchangeManager::UpdateTxopEndOnRxEnd(), ns3::EhtFrameExchangeManager::UpdateTxopEndOnRxStartIndication(), ns3::EhtFrameExchangeManager::UpdateTxopEndOnTxStart(), and BatteryLifetimeTest::VariableLoadTest().

◆ Clear()

void ns3::Time::Clear ( Time *const time)
staticprivate

Remove a Time instance from the MarkedTimes, called by ~Time().

Parameters
[in]timeThe Time instance to remove.

Definition at line 337 of file time.cc.

References ns3::g_markingMutex, g_markingTimes, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, and NS_LOG_WARN.

Referenced by ~Time().

+ Here is the caller graph for this function:

◆ ClearMarkedTimes()

void ns3::Time::ClearMarkedTimes ( )
staticprivate

Remove all MarkedTimes.

Internal:
Has to be visible to the Simulator class, hence the friending.
Internal:

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. The mutex can not be locked more than once in the same thread, so calling this function from ConvertTimes is a bad idea.

Instead, we copy this body into ConvertTimes.

Definition at line 285 of file time.cc.

References ns3::g_markingMutex, g_markingTimes, NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.

Referenced by ns3::Simulator::Run().

+ Here is the caller graph for this function:

◆ Compare()

int ns3::Time::Compare ( const Time & o) const
inline

Compare this to another Time.

Parameters
[in]oThe other Time
Returns
-1,0,+1 if this < o, this == o, or this > o

Definition at line 351 of file nstime.h.

References m_data.

◆ ConvertTimes()

void ns3::Time::ConvertTimes ( const Unit unit)
staticprivate

Convert existing Times to the new unit.

Parameters
[in]unitThe Unit to convert existing Times to.

Definition at line 365 of file time.cc.

References ns3::g_markingMutex, g_markingTimes, m_data, NS_ASSERT_MSG, NS_LOG_FUNCTION_NOARGS, NS_LOG_LOGIC, and ToInteger().

Referenced by SetResolution().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ From() [1/2]

static Time ns3::Time::From ( const int64x64_t & value)
inlinestatic

Create a Time in the current unit.

Parameters
[in]valueThe value of the new Time.
Returns
A Time with value in the current time unit.

Definition at line 470 of file nstime.h.

References Time().

Referenced by ns3::Days(), RttEstimatorTestCase::DoRun(), ns3::FemtoSeconds(), FromDouble(), ns3::Hours(), ns3::RttMeanDeviation::IntegerUpdate(), ns3::MicroSeconds(), ns3::MilliSeconds(), ns3::Minutes(), ns3::NanoSeconds(), ns3::PicoSeconds(), RoundTo(), ns3::Seconds(), and ns3::Years().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ From() [2/2]

static Time ns3::Time::From ( const int64x64_t & value,
Unit unit )
inlinestatic

Create a Time equal to value in unit unit.

Parameters
[in]valueThe new Time value, expressed in unit
[in]unitThe unit of value
Returns
The Time representing value in unit

Definition at line 510 of file nstime.h.

References Time(), ns3::Time::Information::fromMul, ns3::Time::Information::isValid, ns3::int64x64_t::MulByInvert(), NS_ASSERT_MSG, PeekInformation(), and ns3::Time::Information::timeFrom.

+ Here is the call graph for this function:

◆ FromDouble()

static Time ns3::Time::FromDouble ( double value,
Unit unit )
inlinestatic

Create a Time equal to value in unit unit.

Parameters
[in]valueThe new Time value, expressed in unit
[in]unitThe unit of value
Returns
The Time representing value in unit

Definition at line 505 of file nstime.h.

References From().

Referenced by Time(), ns3::Days(), ns3::RttMeanDeviation::FloatingPointUpdate(), ns3::Hours(), ns3::Minutes(), ns3::TcpSocketBase::ReTxTimeout(), ns3::Seconds(), and ns3::Years().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FromInteger()

static Time ns3::Time::FromInteger ( uint64_t value,
Unit unit )
inlinestatic

Create a Time equal to value in unit unit.

Parameters
[in]valueThe new Time value, expressed in unit
[in]unitThe unit of value
Returns
The Time representing value in unit

Definition at line 488 of file nstime.h.

References Time(), ns3::Time::Information::factor, ns3::Time::Information::fromMul, ns3::Time::Information::isValid, NS_ASSERT_MSG, and PeekInformation().

Referenced by ns3::FemtoSeconds(), ns3::Ipv4ClickRouting::HandleScheduleFromClick(), ns3::MicroSeconds(), ns3::MilliSeconds(), ns3::NanoSeconds(), and ns3::PicoSeconds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDays()

double ns3::Time::GetDays ( ) const
inline

Get an approximation of the time stored in this instance in the indicated unit.

Returns
An approximate value in the indicated unit.

Definition at line 377 of file nstime.h.

References D, and ToDouble().

+ Here is the call graph for this function:

◆ GetDouble()

double ns3::Time::GetDouble ( ) const
inline

Get the raw time value, in the current resolution unit.

Returns
The raw time value

Definition at line 439 of file nstime.h.

References m_data.

Referenced by TimeSimpleTestCase::TestMultiplicationByDecimalTypes(), and ns3::TcpHtcp::UpdateBeta().

+ Here is the caller graph for this function:

◆ GetFemtoSeconds()

int64_t ns3::Time::GetFemtoSeconds ( ) const
inline

Get an approximation of the time stored in this instance in the indicated unit.

Returns
An approximate value in the indicated unit.

Definition at line 417 of file nstime.h.

References FS, and ToInteger().

Referenced by DataRateTestCase::CheckTimesEqual(), ns3::HtPhy::GetPayloadDuration(), ns3::OfdmPhy::GetPayloadDuration(), and ns3::Ipv4ClickRouting::GetTimevalFromNow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetHours()

double ns3::Time::GetHours ( ) const
inline

Get an approximation of the time stored in this instance in the indicated unit.

Returns
An approximate value in the indicated unit.

Definition at line 382 of file nstime.h.

References H, and ToDouble().

Referenced by ns3::lorawan::LoraHelper::DoPrintSimulationTime(), and GraphBattery5().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetInteger()

int64_t ns3::Time::GetInteger ( ) const
inline

Get the raw time value, in the current resolution unit.

Returns
The raw time value

Definition at line 444 of file nstime.h.

References GetTimeStep().

Referenced by ns3::DistributedSimulatorImpl::CalculateLookAhead(), RttEstimatorTestCase::DoRun(), TimeSimpleTestCase::DoRun(), ns3::RttMeanDeviation::IntegerUpdate(), ns3::NullMessageMpiInterface::SendNullMessage(), ns3::GrantedTimeWindowMpiInterface::SendPacket(), ns3::NullMessageMpiInterface::SendPacket(), and anonymous_namespace{traced-value-callback-typedef-test-suite.cc}::TracedValueCbSink< Time >().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMicroSeconds()

int64_t ns3::Time::GetMicroSeconds ( ) const
inline

Get an approximation of the time stored in this instance in the indicated unit.

Returns
An approximate value in the indicated unit.

Definition at line 402 of file nstime.h.

References ToInteger(), and US.

Referenced by ns3::dot11s::IeBeaconTiming::BeaconIntervalToU16(), OfdmaAckSequenceTest::CheckResults(), CheckT1QueueSize(), CheckT2QueueSize(), CoDelQueueDiscBasicDrop::Dequeue(), CoDelQueueDiscBasicMark::Dequeue(), ns3::ApWifiMac::DoInitialize(), LrWpanSlottedCsmacaTestCase::DoRun(), WifiTxopTest::DoRun(), ns3::CommonInfoBasicMle::EncodeEmlsrPaddingDelay(), ns3::CommonInfoBasicMle::EncodeEmlsrTransitionDelay(), ns3::dot11s::HwmpProtocol::GetActivePathLifetime(), ns3::ApWifiMac::GetEdcaParameterSet(), ns3::TidToLinkMapping::GetMappingSwitchTime(), ns3::Ipv4ClickRouting::GetTimevalFromNow(), Ns3TcpLossTestCase::Ipv4L3Tx(), Ns3TcpStateTestCase::Ipv4L3Tx(), PacketDequeue(), PrintIntermediateTput(), ns3::MinstrelWifiManager::PrintTable(), ns3::dot11s::HwmpProtocol::ReceivePreq(), PingTestCase::ReportTraceSink(), ns3::MeshWifiInterfaceMac::SendBeacon(), ns3::dot11s::HwmpProtocol::SendProactivePreq(), ns3::dot11s::PeerLink::SetBeaconInformation(), ns3::ApWifiMac::SetBeaconInterval(), ns3::dot11s::PeerLink::SetConfirmTimer(), ns3::DsssPpdu::SetDsssHeader(), ns3::TidToLinkMapping::SetExpectedDuration(), ns3::dot11s::PeerLink::SetHoldingTimer(), ns3::TidToLinkMapping::SetMappingSwitchTime(), ns3::CommonInfoBasicMle::SetMediumSyncDelayTimer(), ns3::MuEdcaParameterSet::SetMuEdcaTimer(), ns3::dot11s::PeerLink::SetRetryTimer(), ns3::MultiLinkElement::SetTransitionTimeout(), ns3::Txop::SetTxopLimit(), ns3::MinstrelHtWifiManager::StatsDump(), ns3::dot11s::IeBeaconTiming::TimestampToU16(), ns3::MinstrelWifiManager::UpdateStats(), ns3::PcapFileWrapper::Write(), ns3::PcapFileWrapper::Write(), and ns3::PcapFileWrapper::Write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMilliSeconds()

int64_t ns3::Time::GetMilliSeconds ( ) const
inline

Get an approximation of the time stored in this instance in the indicated unit.

Returns
An approximate value in the indicated unit.

Definition at line 397 of file nstime.h.

References MS, and ToInteger().

Referenced by ns3::aodv::RrepHeader::RrepHeader(), ns3::PieQueueDisc::CalculateP(), ns3::TcpLedbat::CongestionAvoidance(), ns3::TraceFadingLossModel::DoCalcRxPowerSpectralDensity(), ns3::PieQueueDisc::DoEnqueue(), ThreeGppAntennaSetupChangedTest::DoGetChannel(), ThreeGppChannelMatrixUpdateTest::DoGetChannel(), ns3::A3RsrpHandoverAlgorithm::DoInitialize(), ns3::LteRlcAm::DoReportBufferStatus(), ns3::LteRlcTm::DoReportBufferStatus(), ns3::LteRlcUm::DoReportBufferStatus(), LenaDataPhyErrorModelTestCase::DoRun(), LenaDlCtrlPhyErrorModelTestCase::DoRun(), LteUeMeasurementsHandoverTestCase::DoRun(), Ns3TcpCubicTestCase::DoRun(), ns3::TcpOptionTS::ElapsedTimeFromTsValue(), ns3::LteSpectrumPhy::EndRxData(), LteHandoverTargetTestCase::HandoverStartCallback(), ns3::TcpYeah::IncreaseWindow(), TcpVegasTest::IncreaseWindow(), ns3::TraceFadingLossModel::LoadTrace(), ns3::TcpOptionTS::NowToTsValue(), PingRtt(), ns3::TcpLp::PktsAcked(), ns3::TcpYeah::PktsAcked(), ns3::TcpHybla::RecalcParam(), ns3::TcpIllinois::RecalcParam(), TcpIllinoisTest::RecalcParam(), ns3::LteUePhy::ReceiveLteControlMessageList(), LteUeMeasurementsHandoverTestCase::RecvMeasurementReportCallback(), LteUeMeasurementsPiecewiseTestCase1::RecvMeasurementReportCallback(), LteUeMeasurementsPiecewiseTestCase2::RecvMeasurementReportCallback(), LteUeMeasurementsPiecewiseTestCase3::RecvMeasurementReportCallback(), ns3::UanHeaderRcCts::Serialize(), ns3::UanHeaderRcCtsGlobal::Serialize(), ns3::UanHeaderRcData::Serialize(), ns3::UanHeaderRcRts::Serialize(), ns3::aodv::RrepHeader::SetHello(), ns3::aodv::RrepHeader::SetLifeTime(), and ns3::LteEnbPhy::StartSubFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetMinutes()

double ns3::Time::GetMinutes ( ) const
inline

Get an approximation of the time stored in this instance in the indicated unit.

Returns
An approximate value in the indicated unit.

Definition at line 387 of file nstime.h.

References MIN, and ToDouble().

Referenced by GraphBattery1(), GraphBattery2(), and GraphBattery4().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetNanoSeconds()

int64_t ns3::Time::GetNanoSeconds ( ) const
inline

Get an approximation of the time stored in this instance in the indicated unit.

Returns
An approximate value in the indicated unit.

Definition at line 407 of file nstime.h.

References NS, and ToInteger().

Referenced by ns3::CtrlTriggerHeader::CtrlTriggerHeader(), ns3::OfdmPhy::CalculateDataRate(), ns3::AcousticModemEnergyModel::ChangeState(), ns3::lorawan::LoraRadioEnergyModel::ChangeState(), ns3::CoDelGetTime(), ns3::HePhy::ConvertHeTbPpduDurationToLSigLength(), CobaltQueueDiscMarkTest::Dequeue(), ns3::MinstrelHtWifiManager::DoGetDataTxVector(), ns3::LtePdcp::DoReceivePdu(), ns3::LteRlcAm::DoReceivePdu(), ns3::LteRlcSm::DoReceivePdu(), ns3::LteRlcUm::DoReceivePdu(), TimeInputOutputTestCase::DoRun(), anonymous_namespace{sample-show-progress.cc}::Hold::Event(), ns3::EhtPhy::GetDataRate(), ns3::HePhy::GetDataRate(), ns3::HtPhy::GetDataRate(), ns3::VhtPhy::GetDataRate(), ns3::HePpdu::GetGuardIntervalAndNltfEncoding(), ns3::MinstrelHtWifiManager::GetHeGroupId(), ns3::MinstrelHtWifiManager::GetHtGroupId(), ns3::HtPhy::GetNumberBccEncoders(), ns3::VhtPhy::GetNumberBccEncoders(), ns3::HtPhy::GetPayloadDuration(), ns3::OfdmPhy::GetPayloadDuration(), ns3::WifiPhyHelper::GetRadiotapHeader(), ns3::HePhy::GetSymbolDuration(), ns3::HtPhy::GetSymbolDuration(), ns3::Ipv4ClickRouting::GetTimevalFromNow(), ns3::MinstrelHtWifiManager::GetVhtGroupId(), SimulatorEventsTestCase::NowUs(), ns3::PdcpTag::Serialize(), ns3::RlcTag::Serialize(), ns3::WifiMacHeader::SetDuration(), ns3::CtrlTriggerHeader::SetGiAndLtfType(), ns3::HeConfiguration::SetGuardInterval(), ns3::HtPpdu::SetHtSigHeader(), ns3::HePpdu::SetLSigHeader(), ns3::HtPpdu::SetLSigHeader(), ns3::VhtPpdu::SetLSigHeader(), ns3::HePhy::SetTrigVector(), ns3::VhtPpdu::SetVhtSigHeader(), ns3::CobaltQueueDisc::Time2CoDel(), ns3::CoDelQueueDisc::Time2CoDel(), ns3::energy::BasicEnergyHarvester::UpdateHarvestedPower(), ns3::PcapFileWrapper::Write(), ns3::PcapFileWrapper::Write(), and ns3::PcapFileWrapper::Write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetPicoSeconds()

int64_t ns3::Time::GetPicoSeconds ( ) const
inline

Get an approximation of the time stored in this instance in the indicated unit.

Returns
An approximate value in the indicated unit.

Definition at line 412 of file nstime.h.

References PS, and ToInteger().

Referenced by ns3::Ipv4ClickRouting::GetTimevalFromNow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetResolution()

Time::Unit ns3::Time::GetResolution ( )
static
Returns
The current global resolution.

Definition at line 397 of file time.cc.

References PeekResolution(), and ns3::Time::Resolution::unit.

Referenced by ns3::DefaultTimePrinter(), DataRateTestCase1::DoRun(), and ns3::operator<<().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSeconds()

double ns3::Time::GetSeconds ( ) const
inline

Get an approximation of the time stored in this instance in the indicated unit.

Returns
An approximate value in the indicated unit.

Definition at line 392 of file nstime.h.

References S, and ToDouble().

Referenced by ns3::RttEstimator::RttEstimator(), ns3::lorawan::LoraInterferenceHelper::Add(), ns3::lorawan::LogicalLoraChannelHelper::AddEvent(), ns3::dot11s::HwmpRtable::AddReactivePath(), ns3::AsciiPhyReceiveSinkWithContext(), ns3::AsciiPhyReceiveSinkWithoutContext(), ns3::AsciiPhyRxOkEvent(), ns3::AsciiPhyTransmitSinkWithContext(), ns3::AsciiPhyTransmitSinkWithoutContext(), ns3::AsciiPhyTxEvent(), ns3::WimaxHelper::AsciiRxEvent(), ns3::WimaxHelper::AsciiTxEvent(), ns3::RandomWalk2dOutdoorMobilityModel::AvoidBuilding(), BackoffTrace(), BytesInQueueTrace(), ns3::ThreeGppSpectrumPropagationLossModel::CalcBeamformingGain(), ns3::InterferenceHelper::CalculateChunkSuccessRate(), ns3::SimpleOfdmWimaxPhy::CalculateDataRate(), ns3::PieQueueDisc::CalculateP(), ns3::InterferenceHelper::CalculatePayloadChunkSuccessRate(), ns3::energy::GenericBatteryModel::CalculateRemainingEnergy(), ns3::energy::LiIonEnergySource::CalculateRemainingEnergy(), TcpYeahDecrementTest::CalculateSsThresh(), CalculateThroughput(), ns3::MinstrelHtWifiManager::CalculateThroughput(), ns3::LteUeRrc::CancelEnteringTrigger(), ns3::LteUeRrc::CancelEnteringTrigger(), ns3::LteUeRrc::CancelLeavingTrigger(), ns3::LteUeRrc::CancelLeavingTrigger(), ns3::lrwpan::LrWpanCsmaCa::CanProceed(), ns3::AcousticModemEnergyModel::ChangeState(), ns3::lorawan::LoraRadioEnergyModel::ChangeState(), CheckQueueDiscSize(), CheckQueueSize(), CheckQueueSize(), CheckQueueSize(), CheckT1QueueSize(), CheckT2QueueSize(), ThreeGppHttpObjectTestCase::ClientRxDelayCallback(), ThreeGppHttpObjectTestCase::ClientRxRttCallback(), ns3::CobaltQueueDisc::CobaltShouldDrop(), ns3::UanMacRcGw::ComputeAlpha(), ns3::UanMacRcGw::ComputeExpS(), ComputeSnr(), ComputeSnr(), ComputeSnr(), Ns2MobilityHelperTest::CourseChange(), WaypointMobilityModelNotifyTest::CourseChangeCallback(), ns3::AnimationInterface::CsmaPhyTxEndTrace(), CwndChange(), CwndChange(), CwndChange(), CwndTrace(), CwndTracer(), CwndTracer(), CwndTracer(), Ns3TcpLossTestCase::CwndTracer(), CwTrace(), LrWpanDataIfsTestCase::DataReceivedDev0(), LrWpanDataIfsTestCase::DataReceivedDev1(), CobaltQueueDiscCeThresholdTest::DequeueWithDelay(), CobaltQueueDiscEnhancedBlueTest::DequeueWithDelay(), ns3::AnimationInterface::DevTxTrace(), ns3::MacStatsCalculator::DlScheduling(), ns3::TraceFadingLossModel::DoCalcRxPowerSpectralDensity(), ns3::CoDelQueueDisc::DoDequeue(), ns3::PieQueueDisc::DoDequeue(), ns3::TbfQueueDisc::DoDequeue(), ns3::SimpleOfdmWimaxPhy::DoGetFrameDurationCode(), ns3::SimpleOfdmWimaxPhy::DoGetNrBytes(), ns3::SimpleOfdmWimaxPhy::DoGetNrSymbols(), ns3::dot11s::HwmpProtocol::DoInitialize(), ns3::MeshWifiInterfaceMac::DoInitialize(), ns3::Rip::DoInitialize(), ns3::RipNg::DoInitialize(), ns3::lorawan::LoraHelper::DoPrintDeviceStatus(), ns3::lorawan::LoraHelper::DoPrintGlobalPerformance(), ns3::lorawan::LoraHelper::DoPrintPhyPerformance(), TcpHyblaIncrementTest::DoRun(), TcpVenoTest::DoRun(), TimeOnAirTest::DoRun(), TimeWithSignTestCase::DoRun(), ns3::SimpleOfdmWimaxPhy::DoSetPhyParameters(), ns3::GaussMarkovMobilityModel::DoWalk(), ns3::RandomWalk2dMobilityModel::DoWalk(), ns3::RandomWalk2dOutdoorMobilityModel::DoWalk(), DropAtQueue(), ns3::PieQueueDisc::DropEarly(), DroppingStateTracer(), ns3::LteChunkProcessor::End(), ns3::BaseStationNetDevice::EndDlSubFrame(), ns3::BaseStationNetDevice::EndUlSubFrame(), CobaltQueueDiscCeThresholdTest::EnqueueWithDelay(), ns3::TcpWestwoodPlus::EstimateBW(), ns3::LteChunkProcessor::EvaluateChunk(), ns3::ShannonSpectrumErrorModel::EvaluateChunk(), EveryDropTracer(), anonymous_namespace{sample-simulator.cc}::ExampleFunction(), ns3::SpectrumAnalyzer::GenerateReport(), ns3::TcpRateLinux::GenerateSample(), GenerateTraffic(), ns3::lorawan::LogicalLoraChannelHelper::GetAggregatedWaitingTime(), ns3::lorawan::EndDeviceLorawanMac::GetChannelForTx(), ns3::UanMacRcGw::GetExpPdk(), ns3::lorawan::ClassAEndDeviceLorawanMac::GetNextClassTransmissionDelay(), ns3::lorawan::EndDeviceLorawanMac::GetNextTransmissionDelay(), ns3::lorawan::LoraPhy::GetOnAirTime(), ns3::lrwpan::LrWpanCsmaCa::GetTimeToNextSlot(), ns3::Ipv4ClickRouting::GetTimevalFromNow(), ns3::energy::SimpleDeviceEnergyModel::GetTotalEnergyConsumption(), ns3::JakesProcess::Oscillator::GetValueAt(), ns3::lorawan::LogicalLoraChannelHelper::GetWaitingTime(), GoodputSampling(), anonymous_namespace{sample-simulator.cc}::MyModel::HandleEvent(), Ipv4DynamicGlobalRoutingTestCase::HandleRead(), ns3::TcpVegas::IncreaseWindow(), ns3::TcpVeno::IncreaseWindow(), ns3::TcpYeah::IncreaseWindow(), TcpYeahIncrementTest::IncreaseWindow(), InFlightTracer(), ns3::RedQueueDisc::InitializeParams(), ns3::TcpBbr::InitPacingRate(), ns3::SubscriberStationNetDevice::InitSubscriberStationNetDevice(), ns3::RraaWifiManager::InitThresholds(), ns3::RrpaaWifiManager::InitThresholds(), 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::lorawan::GatewayStatus::IsAvailableForTransmission(), ns3::lorawan::LoraInterferenceHelper::IsDestroyedByInterference(), LimitsTrace(), MacRxTrace(), MacTxTrace(), modify(), ns3::TcpSocketBase::NewAck(), NextRxTracer(), NextTxTracer(), ns3::operator*(), ns3::operator*(), ns3::operator<<(), PacingRateTracer(), PacketDequeue(), PhyStateTrace(), PhyTxTrace(), ns3::TcpHtcp::PktsAcked(), ns3::lorawan::EndDeviceLorawanMac::postponeTransmission(), ns3::Ipv4RoutingHelper::PrintArpCache(), ns3::Ipv4RoutingHelper::PrintArpCacheEvery(), PrintFairness(), IpAddressHelper::PrintIpAddresses(), PrintPosition(), PrintProgress(), PrintReceivedPacket(), PrintReceivedPacket(), PrintReceivedPacket(), PrintThroughput(), ns3::AnimationInterface::PurgePendingPackets(), ns3::lrwpan::LrWpanCsmaCa::RandomBackoffDelay(), anonymous_namespace{sample-simulator.cc}::RandomFunction(), ns3::RandomWalk2dOutdoorMobilityModel::Rebound(), ns3::OpenFlowSwitchNetDevice::ReceiveFromDevice(), ns3::ofi::LearningController::ReceiveFromSwitch(), RemainingEnergyTrace(), anonymous_namespace{sample-log-time-format.cc}::ReplacementTimePrinter(), ns3::dot11s::HwmpProtocol::Report(), ns3::dot11s::PeerLink::Report(), ns3::flame::FlameProtocol::Report(), ns3::MeshHelper::Report(), ns3::MeshWifiInterfaceMac::Report(), ns3::PhyStatsCalculator::ReportCurrentCellRsrpSinr(), ns3::PhyStatsCalculator::ReportInterference(), ns3::FlowMonitor::ReportLastRx(), ns3::PhyStatsCalculator::ReportUeSinr(), ns3::lorawan::LoraPacketTracker::RequiredTransmissionsCallback(), SampleEmitter::Reschedule(), Experiment::ResetData(), NetAnimExperiment::ResetData(), ResetTrace(), TcpBytesInFlightTest::RTOExpired(), RtoTracer(), TcpRttEstimationTest::RttTrace(), RttTracer(), PingTestCase::RttTraceSink(), Experiment::Run(), RxEvent(), RxTracer(), ns3::lorawan::GatewayLorawanMac::Send(), ns3::DhcpServer::SendAck(), ns3::TcpSocketBase::SendDataPacket(), ns3::TcpSocketCongestedRouter::SendDataPacket(), TcpDctcpCongestedRouter::SendDataPacket(), ns3::TcpSocketBase::SendEmptyPacket(), ns3::TcpSocketSmallAcks::SendEmptyPacket(), ns3::DhcpServer::SendOffer(), ns3::TcpGeneralTest::SendPacket(), ns3::Rip::SendTriggeredRouteUpdate(), ns3::RipNg::SendTriggeredRouteUpdate(), ns3::Rip::SendUnsolicitedRouteUpdate(), ns3::RipNg::SendUnsolicitedRouteUpdate(), ns3::dot11s::PeerLink::SetBeaconInformation(), ns3::energy::SimpleDeviceEnergyModel::SetCurrentA(), ns3::ThreeGppHttpVariables::SetEmbeddedObjectGenerationDelay(), ns3::olsr::MessageHeader::Hello::SetHTime(), ns3::ThreeGppHttpVariables::SetMainObjectGenerationDelay(), ns3::ThreeGppHttpVariables::SetParsingTimeMean(), ns3::ThreeGppHttpVariables::SetReadingTimeMean(), ns3::DhcpHeader::SetTime(), ns3::TimeProbe::SetValue(), ns3::olsr::MessageHeader::SetVTime(), showPosition(), SocketPrinter(), SocketSendTrace(), SsThreshTracer(), SsThreshTracer(), ns3::lorawan::PeriodicSender::StartApplication(), ns3::UanMacRcGw::StartCycle(), ns3::BaseStationNetDevice::StartDlSubFrame(), Ns3TcpLossTestCase::StartFlow(), Ns3TcpStateTestCase::StartFlow(), ns3::BaseStationNetDevice::StartFrame(), ns3::lorawan::SimpleEndDeviceLoraPhy::StartReceive(), ns3::BaseStationNetDevice::StartUlSubFrame(), TcPacketsInQueue(), TestDeterministicByTime(), Throughput(), TraceDrop(), TraceDropsFrequency(), TraceFirstCwnd(), TraceFirstDctcp(), TraceFirstRtt(), TraceFirstThroughput(), TraceMark(), TraceMarksFrequency(), TraceN0Cwnd(), TraceN0Rtt(), TraceN0Throughput(), TraceN1Cwnd(), TraceN1Rtt(), TraceN1Throughput(), TracePingRtt(), TracePingRtt(), TraceQueueDrop(), TraceQueueLength(), TraceQueueLength(), TraceQueueMark(), TraceSecondCwnd(), TraceSecondDctcp(), TraceSecondRtt(), TraceSecondThroughput(), ns3::TimeProbe::TraceSink(), TraceThroughput(), TcpPacingTest::Tx(), TxTracer(), ns3::MacStatsCalculator::UlScheduling(), ns3::ConstantVelocityHelper::Update(), ns3::TcpCubic::Update(), ns3::TcpBbr::UpdateAckAggregation(), ns3::TcpHtcp::UpdateAlpha(), ns3::TcpLedbat::UpdateBaseDelay(), TcpPacingTest::UpdateExpectedInterval(), ns3::energy::BasicEnergyHarvester::UpdateHarvestedPower(), ns3::TcpSocketBase::UpdatePacingRate(), ns3::WriteAveragePowerSpectralDensityReport(), ns3::RadioBearerStatsCalculator::WriteDlResults(), ns3::RadioBearerStatsCalculator::WriteUlResults(), Ns3TcpLossTestCase::WriteUntilBufferFull(), and Ns3TcpStateTestCase::WriteUntilBufferFull().

+ Here is the call graph for this function:

◆ GetTimeStep()

int64_t ns3::Time::GetTimeStep ( ) const
inline

Get the raw time value, in the current resolution unit.

Returns
The raw time value

Definition at line 434 of file nstime.h.

References m_data.

Referenced by ns3::lrwpan::LrWpanPhy::EndEd(), ns3::lrwpan::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::DistributedSimulatorImpl::Schedule(), ns3::NullMessageSimulatorImpl::Schedule(), ns3::RealtimeSimulatorImpl::Schedule(), ns3::RealtimeSimulatorImpl::ScheduleRealtimeWithContext(), ns3::DefaultSimulatorImpl::ScheduleWithContext(), ns3::DistributedSimulatorImpl::ScheduleWithContext(), ns3::NullMessageSimulatorImpl::ScheduleWithContext(), ns3::RealtimeSimulatorImpl::ScheduleWithContext(), ns3::NullMessageMpiInterface::SendNullMessage(), ns3::GrantedTimeWindowMpiInterface::SendPacket(), ns3::NullMessageMpiInterface::SendPacket(), ns3::AmpduTag::Serialize(), ns3::SeqTsEchoHeader::Serialize(), ns3::TimestampTag::Serialize(), ns3::ThreeGppHttpHeader::SetClientTs(), ns3::ThreeGppHttpHeader::SetServerTs(), ns3::lrwpan::LrWpanPhy::StartRx(), ns3::DefaultSimulatorImpl::Stop(), ns3::DistributedSimulatorImpl::Stop(), ns3::NullMessageSimulatorImpl::Stop(), TimeSimpleTestCase::TestDivisionByIntegerTypes(), TimeSimpleTestCase::TestMultiplicationByIntegerTypes(), ns3::DesMetrics::TraceWithContext(), and WifiFilsFrameTest::ValidateTiming().

+ Here is the caller graph for this function:

◆ GetYears()

double ns3::Time::GetYears ( ) const
inline

Get an approximation of the time stored in this instance in the indicated unit.

Returns
An approximate value in the indicated unit.

Definition at line 372 of file nstime.h.

References ToDouble(), and Y.

+ Here is the call graph for this function:

◆ IsNegative()

bool ns3::Time::IsNegative ( ) const
inline

Exactly equivalent to t <= 0.

Returns
true if the time is negative or zero, false otherwise.

Definition at line 313 of file nstime.h.

References m_data.

Referenced by ns3::RandomWalk2dOutdoorMobilityModel::DoWalk(), ns3::QosFrameExchangeManager::IsWithinSizeAndTimeLimits(), and ns3::RrMultiUserScheduler::TrySendingBasicTf().

+ Here is the caller graph for this function:

◆ IsPositive()

bool ns3::Time::IsPositive ( ) const
inline

Exactly equivalent to t >= 0.

Returns
true if the time is positive or zero, false otherwise.

Definition at line 322 of file nstime.h.

References m_data.

Referenced by ThreeGppHttpObjectTestCase::ThreeGppHttpObjectTestCase(), ns3::energy::BasicEnergySource::CalculateRemainingEnergy(), ns3::TcpLedbat::PktsAcked(), ns3::DefaultSimulatorImpl::Schedule(), ns3::DistributedSimulatorImpl::Schedule(), ns3::NullMessageSimulatorImpl::Schedule(), ns3::RealtimeSimulatorImpl::Schedule(), ns3::NullMessageSimulatorImpl::ScheduleWithContext(), and ns3::Txop::SetTxopLimit().

+ Here is the caller graph for this function:

◆ IsStrictlyNegative()

bool ns3::Time::IsStrictlyNegative ( ) const
inline

Exactly equivalent to t < 0.

Returns
true if the time is strictly negative, false otherwise.

Definition at line 331 of file nstime.h.

References m_data.

Referenced by ns3::FrameExchangeManager::DoSendCtsAfterRts(), ns3::QosTxop::GetRemainingTxop(), ns3::HtFrameExchangeManager::SendBlockAck(), and ns3::FrameExchangeManager::SendNormalAck().

+ Here is the caller graph for this function:

◆ IsStrictlyPositive()

◆ IsZero()

bool ns3::Time::IsZero ( ) const
inline

Exactly equivalent to t == 0.

Returns
true if the time is zero, false otherwise.

Definition at line 304 of file nstime.h.

References m_data.

Referenced by ns3::InterferenceHelper::CalculateChunkSuccessRate(), ns3::InterferenceHelper::CalculatePayloadChunkSuccessRate(), ns3::TcpSocketBase::CalculateRttSample(), ns3::ThreeGppChannelModel::ChannelParamsNeedsUpdate(), EmlsrDlTxopTest::CheckBlockAck(), EmlsrUlTxopTest::CheckCtsFrames(), EmlsrDlTxopTest::CheckQosFrames(), EmlsrUlTxopTest::CheckRtsFrames(), WifiPrimaryChannelsTest::DoSendHeTbPpdu(), ns3::EhtFrameExchangeManager::EmlsrSwitchToListening(), ns3::TcpWestwoodPlus::EstimateBW(), ns3::TcpSocketBase::EstimateRtt(), ns3::ThreeGppChannelConditionModel::GetChannelCondition(), ns3::QosFrameExchangeManager::GetCtsToSelfDurationId(), ns3::QosFrameExchangeManager::GetFrameDurationId(), ns3::ApWifiMac::GetMuEdcaParameterSet(), ns3::HeFrameExchangeManager::GetMuRtsDurationId(), ns3::HtFrameExchangeManager::GetPsduDurationId(), ns3::QosFrameExchangeManager::GetRtsDurationId(), ns3::lrwpan::LrWpanMac::PdDataConfirm(), ns3::TcpIllinois::PktsAcked(), ns3::TcpLp::PktsAcked(), ns3::TcpVegas::PktsAcked(), ns3::TcpVeno::PktsAcked(), ns3::TcpWestwoodPlus::PktsAcked(), ns3::TcpYeah::PktsAcked(), ns3::ThreeGppHttpClient::ReceiveEmbeddedObject(), ns3::ofi::LearningController::ReceiveFromSwitch(), ns3::ThreeGppHttpClient::ReceiveMainObject(), ns3::PhyEntity::ScheduleEndOfMpdus(), ns3::PacketSocketClient::Send(), EmlsrDlTxopTest::StartTraffic(), ns3::QosFrameExchangeManager::StartTransmission(), ns3::UanPdp::SumTapsFromMaxC(), ns3::UanPdp::SumTapsFromMaxNc(), ns3::WifiPhyStateHelper::SwitchToChannelSwitching(), ns3::HtFrameExchangeManager::TransmissionSucceeded(), ns3::RrMultiUserScheduler::TrySendingBasicTf(), and ns3::TcpBbr::UpdateBottleneckBandwidth().

+ Here is the caller graph for this function:

◆ Mark()

void ns3::Time::Mark ( Time *const time)
staticprivate

Record a Time instance with the MarkedTimes.

Parameters
[in]timeThe Time instance to record.

Definition at line 314 of file time.cc.

References ns3::g_markingMutex, g_markingTimes, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, and NS_LOG_WARN.

Referenced by Time(), Time(), Time(), Time(), Time(), Time(), Time(), Time(), Time(), Time(), Time(), and Time().

+ Here is the caller graph for this function:

◆ Max()

static Time ns3::Time::Max ( )
inlinestatic

Maximum representable Time Not to be confused with Max(Time,Time).

Returns
the maximum representable Time.

Definition at line 286 of file nstime.h.

References Time().

Referenced by ns3::FqCobaltQueueDisc::CheckConfig(), ns3::FqCoDelQueueDisc::CheckConfig(), ns3::FqPieQueueDisc::CheckConfig(), ns3::TcpBbr::CongestionStateSet(), ns3::PieQueueDisc::DoEnqueue(), ns3::WifiMacQueue::DoEnqueue(), CobaltQueueDiscBasicEnqueueDequeue::DoRun(), CobaltQueueDiscCeThresholdTest::DoRun(), CobaltQueueDiscEnhancedBlueTest::DoRun(), CobaltQueueDiscMarkTest::DoRun(), FqCobaltQueueDiscEcnMarking::DoRun(), ns3::TcpVegas::EnableVegas(), ns3::TcpVeno::EnableVeno(), ns3::TcpYeah::EnableYeah(), ns3::lorawan::EndDeviceLorawanMac::GetNextTransmissionDelay(), ns3::TcpHtcp::GetSsThresh(), ns3::ArpCache::Entry::GetTimeout(), ns3::CobaltQueueDisc::GetTypeId(), ns3::CoDelQueueDisc::GetTypeId(), ns3::FqCobaltQueueDisc::GetTypeId(), ns3::FqCoDelQueueDisc::GetTypeId(), ns3::FqPieQueueDisc::GetTypeId(), ns3::PieQueueDisc::GetTypeId(), ns3::TcpVegas::IncreaseWindow(), ns3::TcpVeno::IncreaseWindow(), ns3::TcpYeah::IncreaseWindow(), ns3::TcpBbr::InFlight(), ns3::TcpBbr::InitPacingRate(), ns3::lorawan::LoraPacketTracker::MacTransmissionCallback(), ns3::MakeTimeChecker(), ns3::MakeTimeChecker(), CobaltQueueDiscDropTest::RunDropTest(), ns3::TcpBbr::SetPacingRate(), ns3::TcpRateLinux::SkbDelivered(), and TcpRateLinuxBasicTest::SkbDelivered().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Min()

◆ operator=()

Time & ns3::Time::operator= ( const Time & o)
inline

Assignment operator.

Parameters
[in]oTime to assign.
Returns
The Time.

Definition at line 120 of file nstime.h.

References m_data.

◆ PeekInformation()

static Information * ns3::Time::PeekInformation ( Unit timeUnit)
inlinestaticprivate

Get the Information record for timeUnit for the current Resolution.

Parameters
[in]timeUnitThe Unit to get Information for
Returns
The Information for timeUnit

Definition at line 656 of file nstime.h.

References ns3::Time::Resolution::info, and PeekResolution().

Referenced by From(), FromInteger(), To(), and ToInteger().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PeekResolution()

static Resolution * ns3::Time::PeekResolution ( )
inlinestaticprivate

Get the current Resolution.

Returns
A pointer to the current Resolution

Definition at line 644 of file nstime.h.

References SetDefaultNsResolution().

Referenced by GetResolution(), PeekInformation(), and SetResolution().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RoundTo()

Time ns3::Time::RoundTo ( Unit unit) const
inline

Round a Time to a specific unit.

Rounding is to nearest integer.

Parameters
[in]unitThe unit to round to.
Returns
The Time rounded to the specific unit.

Definition at line 593 of file nstime.h.

References From(), and To().

Referenced by ns3::UanHeaderRcCts::Serialize(), ns3::UanHeaderRcCtsGlobal::Serialize(), ns3::UanHeaderRcData::Serialize(), and ns3::UanHeaderRcRts::Serialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDefaultNsResolution()

Time::Resolution & ns3::Time::SetDefaultNsResolution ( )
staticprivate

Set the default resolution.

Returns
The Resolution object for the default resolution.

Definition at line 192 of file time.cc.

References NS, NS_LOG_FUNCTION_NOARGS, and SetResolution().

Referenced by PeekResolution().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetResolution() [1/2]

void ns3::Time::SetResolution ( Unit resolution)
static
Parameters
[in]resolutionThe 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 202 of file time.cc.

References NS_LOG_FUNCTION, PeekResolution(), and SetResolution().

Referenced by AttributeTestCase< T >::DoRun(), DataRateTestCase1::DoRun(), TimeSimpleTestCase::DoRun(), SetDefaultNsResolution(), and SetResolution().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetResolution() [2/2]

void ns3::Time::SetResolution ( Unit unit,
Resolution * resolution,
const bool convert = true )
staticprivate

Set the current Resolution.

Parameters
[in]unitThe unit to use as the new resolution.
[in,out]resolutionThe Resolution record to update.
[in]convertWhether to convert existing Time objects to the new resolution.

Definition at line 210 of file time.cc.

References ConvertTimes(), ns3::Time::Information::factor, ns3::Time::Information::fromMul, ns3::Time::Resolution::info, ns3::int64x64_t::Invert(), ns3::Time::Information::isValid, 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.

+ Here is the call graph for this function:

◆ StaticInit()

bool ns3::Time::StaticInit ( )
static

Function to force static initialization of Time.

Returns
true on the first call

Definition at line 86 of file time.cc.

References ns3::g_markingMutex, g_markingTimes, and NS_LOG_ERROR.

Referenced by ns3::TimeInitializationHelper::TimeInitializationHelper().

+ Here is the caller graph for this function:

◆ To()

int64x64_t ns3::Time::To ( Unit unit) const
inline

Get the Time value expressed in a particular unit.

Parameters
[in]unitThe desired unit
Returns
The Time expressed in unit

Definition at line 567 of file nstime.h.

References ns3::Time::Information::isValid, m_data, ns3::int64x64_t::MulByInvert(), NS_ASSERT_MSG, PeekInformation(), ns3::Time::Information::timeTo, and ns3::Time::Information::toMul.

Referenced by RoundTo(), and ToDouble().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToDouble()

double ns3::Time::ToDouble ( Unit unit) const
inline

Get the Time value expressed in a particular unit.

Parameters
[in]unitThe desired unit
Returns
The Time expressed in unit

Definition at line 562 of file nstime.h.

References ns3::int64x64_t::GetDouble(), and To().

Referenced by ns3::RttMeanDeviation::FloatingPointUpdate(), GetDays(), GetHours(), GetMinutes(), GetSeconds(), GetYears(), Ipv4DeduplicationTest::MakeName(), SojournTimeTrace(), and ns3::RrMultiUserScheduler::UpdateCredits().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToInteger()

int64_t ns3::Time::ToInteger ( Unit unit) const
inline

Get the Time value expressed in a particular unit.

Parameters
[in]unitThe desired unit
Returns
The Time expressed in unit

Definition at line 544 of file nstime.h.

References ns3::Time::Information::factor, ns3::Time::Information::isValid, m_data, NS_ASSERT_MSG, PeekInformation(), and ns3::Time::Information::toMul.

Referenced by ConvertTimes(), GetFemtoSeconds(), GetMicroSeconds(), GetMilliSeconds(), GetNanoSeconds(), and GetPicoSeconds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ Abs

Time Abs ( const Time & time)
friend

Absolute value for Time.

Parameters
[in]timeThe Time value
Returns
The absolute value of the input.

Definition at line 1180 of file nstime.h.

◆ Div

int64_t Div ( const Time & lhs,
const Time & rhs )
friend

Integer quotient from dividing two Times.

This is the same as the "normal" C++ integer division, which truncates (discarding any remainder).

As usual, if ta, and tb are both Times

ta == tb * Div (ta, tb) + Rem (ta, tb);
ta == tb * (ta / tb).GetHigh() + ta % tb;
friend Time Rem(const Time &lhs, const Time &rhs)
Addition operator for Time.
Definition nstime.h:1115
friend int64_t Div(const Time &lhs, const Time &rhs)
Integer quotient from dividing two Times.
Definition nstime.h:1143
Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
The integer portion of lhs / rhs.
See also
Rem()

Definition at line 1143 of file nstime.h.

◆ Max

Time Max ( const Time & timeA,
const Time & timeB )
friend

Maximum of two Times.

Parameters
[in]timeAThe first value
[in]timeBThe second value
Returns
The larger of the two operands.

Definition at line 1192 of file nstime.h.

◆ Min

Time Min ( const Time & timeA,
const Time & timeB )
friend

Minimum of two Times.

Parameters
[in]timeAThe first value
[in]timeBThe second value
Returns
The smaller of the two operands.

Definition at line 1204 of file nstime.h.

◆ operator!=

bool operator!= ( const Time & lhs,
const Time & rhs )
friend

Inequality operator for Time.

Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
true if the two input values not are equal.

Definition at line 851 of file nstime.h.

◆ operator%

Time operator% ( const Time & lhs,
const Time & rhs )
friend

Remainder (modulus) from the quotient of two Times.

Rem() and operator% are equivalent:

Rem (ta, tb)  ==  ta % tb;
See also
Div()
Parameters
[in]lhsThe first time value
[in]rhsThe second time value
Returns
The remainder of lhs / rhs.

Definition at line 1109 of file nstime.h.

◆ operator* [1/5]

Time operator* ( const int64x64_t & lhs,
const Time & rhs )
friend

Scale a Time by a numeric value.

Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
The Time scaled by the other operand.

Definition at line 978 of file nstime.h.

◆ operator* [2/5]

Time operator* ( const Time & lhs,
const int64x64_t & rhs )
friend

Scale a Time by a numeric value.

Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
The Time scaled by the other operand.

Definition at line 964 of file nstime.h.

◆ operator* [3/5]

template<class T >
std::enable_if_t< std::is_integral_v< T >, Time > operator* ( const Time & lhs,
T rhs )
friend

Scale a Time by an integer value.

Template Parameters
TInteger data type (int, long, etc.)
Parameters
[in]lhsThe Time instance to scale
[in]rhsThe scale value
Returns
A new Time instance containing the scaled value

Definition at line 994 of file nstime.h.

◆ operator* [4/5]

template<class T >
std::enable_if_t< std::is_floating_point_v< T >, Time > operator* ( const Time & lhs,
T rhs )
friend

Scale a Time by an integer value.

Template Parameters
TInteger data type (int, long, etc.)
Parameters
[in]lhsThe Time instance to scale
[in]rhsThe scale value
Returns
A new Time instance containing the scaled value

Definition at line 994 of file nstime.h.

◆ operator* [5/5]

template<class T >
std::enable_if_t< std::is_arithmetic_v< T >, Time > operator* ( T lhs,
const Time & rhs )
friend

Scale a Time by a numeric value.

This overload handles the case where the scale value comes before the Time value. It swaps the arguments so that the Time argument comes first and calls the appropriate overload of operator*

Template Parameters
TArithmetic data type (int, long, float, etc.)
Parameters
[in]lhsThe scale value
[in]rhsThe Time instance to scale
Returns
A new Time instance containing the scaled value

Definition at line 1024 of file nstime.h.

◆ operator+

Time operator+ ( const Time & lhs,
const Time & rhs )
friend

Addition operator for Time.

Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
The sum of the two input values.

Definition at line 940 of file nstime.h.

◆ operator+=

Time & operator+= ( Time & lhs,
const Time & rhs )
friend

Compound addition assignment for Time.

Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
The sum of the two inputs.

Definition at line 1155 of file nstime.h.

◆ operator-

Time operator- ( const Time & lhs,
const Time & rhs )
friend

Subtraction operator for Time.

Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
The difference of the two input values.

Definition at line 952 of file nstime.h.

◆ operator-=

Time & operator-= ( Time & lhs,
const Time & rhs )
friend

Compound subtraction assignment for Time.

Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
The difference of the two operands.

Definition at line 1168 of file nstime.h.

◆ operator/ [1/4]

Time operator/ ( const Time & lhs,
const int64x64_t & rhs )
friend

Scale a Time by a numeric value.

Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
The Time divided by the scalar operand.

Definition at line 1062 of file nstime.h.

◆ operator/ [2/4]

int64x64_t operator/ ( const Time & lhs,
const Time & rhs )
friend

Exact division, returning a dimensionless fixed point number.

This can be truncated to integer, or converted to double (with loss of precision). Assuming ta and tb are Times:

int64x64_t ratio = ta / tb;
int64_t i = ratio.GetHigh (); // Get just the integer part, resulting in truncation
double ratioD = double (ratio); // Convert to double, with loss of precision
High precision numerical type, implementing Q64.64 fixed precision.
int64_t GetHigh() const
Get the integer portion.
Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
The exact ratio of the two operands.

Definition at line 1048 of file nstime.h.

◆ operator/ [3/4]

template<class T >
std::enable_if_t< std::is_integral_v< T >, Time > operator/ ( const Time & lhs,
T rhs )
friend

Divide a Time by an integer value.

Template Parameters
TInteger data type (int, long, etc.)
Parameters
[in]lhsThe Time instance to scale
[in]rhsThe scale value
Returns
A new Time instance containing the scaled value

Definition at line 1080 of file nstime.h.

◆ operator/ [4/4]

template<class T >
std::enable_if_t< std::is_floating_point_v< T >, Time > operator/ ( const Time & lhs,
T rhs )
friend

Divide a Time by an integer value.

Template Parameters
TInteger data type (int, long, etc.)
Parameters
[in]lhsThe Time instance to scale
[in]rhsThe scale value
Returns
A new Time instance containing the scaled value

Definition at line 1080 of file nstime.h.

◆ operator< [1/2]

bool operator< ( const Time & lhs,
const Time & rhs )
friend

Less than operator for Time.

Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
true if the first input value is less than the second input value.

Definition at line 886 of file nstime.h.

◆ operator< [2/2]

bool operator< ( const Time & time,
const EventId & event )
friend

Compare a Time to an EventId.

This is useful when you have cached a previously scheduled event:

m_event = Schedule (...);

and later you want to know the relationship between that event and some other Time when:

if (when < m_event) ...
Parameters
[in]timeThe Time operand.
[in]eventThe EventId
Returns
true if time is before (less than) the time stamp of the EventId.

Definition at line 921 of file nstime.h.

◆ operator<=

bool operator<= ( const Time & lhs,
const Time & rhs )
friend

Less than or equal operator for Time.

Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
true if the first input value is less than or equal to the second input value.

Definition at line 862 of file nstime.h.

◆ operator==

bool operator== ( const Time & lhs,
const Time & rhs )
friend

Equality operator for Time.

Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
true if the two input values are equal.

Definition at line 839 of file nstime.h.

◆ operator>

bool operator> ( const Time & lhs,
const Time & rhs )
friend

Greater than operator for Time.

Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
true if the first input value is greater than the second input value.

Definition at line 899 of file nstime.h.

◆ operator>=

bool operator>= ( const Time & lhs,
const Time & rhs )
friend

Greater than or equal operator for Time.

Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
true if the first input value is greater than or equal to the second input value.

Definition at line 875 of file nstime.h.

◆ Rem

Time Rem ( const Time & lhs,
const Time & rhs )
friend

Addition operator for Time.

Parameters
[in]lhsThe first value
[in]rhsThe second value
Returns
The sum of the two input values.

Definition at line 1115 of file nstime.h.

◆ TimeStep()

Time TimeStep ( uint64_t ts)
related

Scheduler interface.

Note
This is internal to the Time implementation.
Parameters
[in]tsThe time value, in the current unit.
Returns
A Time.

Definition at line 1390 of file nstime.h.

Member Data Documentation

◆ g_markingTimes

Time::MarkedTimes * ns3::Time::g_markingTimes = nullptr
staticprivate

Record of outstanding Time objects which will need conversion when the resolution is set.

Internal:

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 711 of file nstime.h.

Referenced by Time(), Time(), Time(), Time(), Time(), Time(), Time(), Time(), Time(), Time(), Time(), Time(), ~Time(), Clear(), ClearMarkedTimes(), ConvertTimes(), Mark(), and StaticInit().

◆ m_data

int64_t ns3::Time::m_data
private

Virtual time value, in the current unit.

Definition at line 815 of file nstime.h.

Referenced by Compare(), ConvertTimes(), GetDouble(), GetTimeStep(), IsNegative(), IsPositive(), IsStrictlyNegative(), IsStrictlyPositive(), IsZero(), operator=(), To(), and ToInteger().


The documentation for this class was generated from the following files: