192 explicit inline Time(
long int v)
201 explicit inline Time(
long long int v)
210 explicit inline Time(
unsigned int v)
219 explicit inline Time(
unsigned long int v)
228 explicit inline Time(
unsigned long long int v)
269 explicit Time(
const std::string& s);
278 return Time(std::numeric_limits<int64_t>::min());
288 return Time(std::numeric_limits<int64_t>::max());
441 return static_cast<double>(
m_data);
595 return From(this->
To(unit).Round(), unit);
674 static void SetResolution(
Unit unit, Resolution* resolution,
const bool convert =
true);
781 friend int64_t
Div(
const Time& lhs,
const Time& rhs);
785 friend std::enable_if_t<std::is_integral_v<T>,
Time>
operator*(
const Time& lhs, T rhs);
790 friend std::enable_if_t<std::is_arithmetic_v<T>,
Time>
operator*(T lhs,
const Time& rhs);
793 friend std::enable_if_t<std::is_integral_v<T>,
Time>
operator/(
const Time& lhs, T rhs);
803 friend std::enable_if_t<std::is_floating_point_v<T>,
Time>
operator*(
const Time& lhs, T rhs);
805 friend std::enable_if_t<std::is_floating_point_v<T>,
Time>
operator/(
const Time& lhs, T rhs);
819namespace TracedValueCallback
930 return static_cast<uint64_t
>(time.
m_data) < event.
GetTs();
993std::enable_if_t<std::is_integral_v<T>,
Time>
996 static_assert(!std::is_same_v<T, bool>,
"Multiplying a Time by a boolean is not supported");
1003std::enable_if_t<std::is_floating_point_v<T>,
Time>
1023std::enable_if_t<std::is_arithmetic_v<T>, Time>
1079std::enable_if_t<std::is_integral_v<T>,
Time>
1082 static_assert(!std::is_same_v<T, bool>,
"Dividing a Time by a boolean is not supported");
1089std::enable_if_t<std::is_floating_point_v<T>,
Time>
1428inline Ptr<const AttributeChecker>
NS_ASSERT() and NS_ASSERT_MSG() macro definitions.
Attribute helper (ATTRIBUTE_ )macros definition.
ns3::AttributeValue, ns3::AttributeAccessor and ns3::AttributeChecker declarations.
An identifier for simulation events.
Smart pointer class similar to boost::intrusive_ptr.
Control the scheduling of simulation events.
Simulation virtual time values and global simulation resolution.
friend Time operator%(const Time &lhs, const Time &rhs)
Remainder (modulus) from the quotient of two Times.
int64_t GetNanoSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
bool IsPositive() const
Exactly equivalent to t >= 0.
Time(const Time &o)
Copy constructor.
Time(const int64x64_t &v)
Construct from a numeric value.
friend Time & operator-=(Time &lhs, const Time &rhs)
Compound subtraction assignment for Time.
static void ClearMarkedTimes()
Remove all MarkedTimes.
Time(unsigned long int v)
Construct from a numeric value.
static Time From(const int64x64_t &value)
Create a Time in the current unit.
int64_t GetMilliSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
static Resolution & SetDefaultNsResolution()
Set the default resolution.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Time(long long int v)
Construct from a numeric value.
static void ConvertTimes(const Unit unit)
Convert existing Times to the new unit.
static Information * PeekInformation(Unit timeUnit)
Get the Information record for timeUnit for the current Resolution.
int64_t GetFemtoSeconds() 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.
int64x64_t To(Unit unit) const
Get the Time value expressed in a particular unit.
static Unit GetResolution()
bool IsStrictlyPositive() const
Exactly equivalent to t > 0.
Time & operator=(const Time &o)
Assignment operator.
Time TimeStep(uint64_t ts)
Scheduler interface.
Time(double v)
Construct from a numeric value.
int64_t GetInteger() const
Get the raw time value, in the current resolution unit.
bool IsNegative() const
Exactly equivalent to t <= 0.
static bool StaticInit()
Function to force static initialization of Time.
friend bool operator==(const Time &lhs, const Time &rhs)
Equality operator for Time.
Time(unsigned long long int v)
Construct from a numeric value.
double GetMinutes() const
Get an approximation of the time stored in this instance in the indicated unit.
static Time Min()
Minimum representable Time Not to be confused with Min(Time,Time).
friend Time & operator+=(Time &lhs, const Time &rhs)
Compound addition assignment for Time.
static void Clear(Time *const time)
Remove a Time instance from the MarkedTimes, called by ~Time().
static Time From(const int64x64_t &value, Unit unit)
Create a Time equal to value in unit unit.
Unit
The unit to use to interpret a number representing time.
@ AUTO
auto-scale output when using Time::As()
@ LAST
marker for last normal value
Time()
Default constructor, with value 0.
friend bool operator>=(const Time &lhs, const Time &rhs)
Greater than or equal operator for Time.
double GetDays() const
Get an approximation of the time stored in this instance in the indicated unit.
Time RoundTo(Unit unit) const
Round a Time to a specific unit.
friend bool operator<=(const Time &lhs, const Time &rhs)
Less than or equal operator for Time.
static MarkedTimes * g_markingTimes
Record of outstanding Time objects which will need conversion when the resolution is set.
int64_t m_data
Virtual time value, in the current unit.
friend Time Rem(const Time &lhs, const Time &rhs)
Addition operator for Time.
static Resolution * PeekResolution()
Get the current Resolution.
friend int64_t Div(const Time &lhs, const Time &rhs)
Integer quotient from dividing two Times.
static void Mark(Time *const time)
Record a Time instance with the MarkedTimes.
int64_t GetPicoSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
static void SetResolution(Unit resolution)
double GetYears() const
Get an approximation of the time stored in this instance in the indicated unit.
friend bool operator<(const Time &lhs, const Time &rhs)
Less than operator for Time.
Time(int v)
Construct from a numeric value.
friend bool operator!=(const Time &lhs, const Time &rhs)
Inequality operator for Time.
Time(Time &&o)
Move constructor.
int64_t ToInteger(Unit unit) const
Get the Time value expressed in a particular unit.
static Time FromInteger(uint64_t value, Unit unit)
Create a Time equal to value in unit unit.
bool IsStrictlyNegative() const
Exactly equivalent to t < 0.
Time(unsigned int v)
Construct from a numeric value.
int Compare(const Time &o) const
Compare this to another Time.
static Time FromDouble(double value, Unit unit)
Create a Time equal to value in unit unit.
double GetDouble() const
Get the raw time value, in the current resolution unit.
friend Time operator-(const Time &lhs, const Time &rhs)
Subtraction operator for Time.
friend Time operator+(const Time &lhs, const Time &rhs)
Addition operator for Time.
static Time Max()
Maximum representable Time Not to be confused with Max(Time,Time).
friend Time operator*(const Time &lhs, const int64x64_t &rhs)
Scale a Time by a numeric value.
double ToDouble(Unit unit) const
Get the Time value expressed in a particular unit.
friend bool operator>(const Time &lhs, const Time &rhs)
Greater than operator for Time.
bool IsZero() const
Exactly equivalent to t == 0.
int64_t GetTimeStep() const
Get the raw time value, in the current resolution unit.
int64_t GetMicroSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
friend Time Abs(const Time &time)
Absolute value for Time.
Time(long int v)
Construct from a numeric value.
double GetHours() const
Get an approximation of the time stored in this instance in the indicated unit.
friend int64x64_t operator/(const Time &lhs, const Time &rhs)
Exact division, returning a dimensionless fixed point number.
std::set< Time * > MarkedTimes
Record all instances of Time, so we can rescale them when the resolution changes.
Helper class to force static initialization of Time in each compilation unit, ensuring it is initiali...
TimeInitializationHelper()
Default constructor calls Time::StaticInit.
A Time with attached unit, to facilitate output in that unit.
friend std::ostream & operator<<(std::ostream &os, const TimeWithUnit &timeU)
Output streamer.
TimeWithUnit(const Time time, const Time::Unit unit)
Attach a unit to a Time.
Time::Unit m_unit
The unit to use in output.
Forward calls to a chain of Callback.
High precision numerical type, implementing Q64.64 fixed precision.
void MulByInvert(const int64x64_t &o)
Multiply this value by a Q0.128 value, presumably representing an inverse, completing a division oper...
double GetDouble() const
Get this value as a double.
ns3::EventId declarations.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define ATTRIBUTE_ACCESSOR_DEFINE(type)
Define the attribute accessor functions MakeTypeAccessor for class type .
#define ATTRIBUTE_VALUE_DEFINE(name)
Declare the attribute value class nameValue for the class name
#define TYPENAMEGET_DEFINE(T)
Macro that defines a template specialization for TypeNameGet<T>() .
int64x64_t operator/(const int64x64_t &lhs, const int64x64_t &rhs)
Division operator.
bool operator>=(const int64x64_t &lhs, const int64x64_t &rhs)
Greater or equal operator.
bool operator<=(const int64x64_t &lhs, const int64x64_t &rhs)
Less or equal operator.
int64x64_t operator-(const int64x64_t &lhs, const int64x64_t &rhs)
Subtraction operator.
int64x64_t operator+(const int64x64_t &lhs, const int64x64_t &rhs)
Addition operator.
int64x64_t Abs(const int64x64_t &value)
Absolute value.
int64x64_t operator*(const int64x64_t &lhs, const int64x64_t &rhs)
Multiplication operator.
bool operator>(const Length &left, const Length &right)
Check if left has a value greater than right.
int64_t Div(const Length &numerator, const Length &denominator, Length *remainder)
Calculate how many times numerator can be split into denominator sized pieces.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time Days(double value)
Construct a Time in the indicated unit.
Time Hours(double value)
Construct a Time in the indicated unit.
Time PicoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time FemtoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Minutes(double value)
Construct a Time in the indicated unit.
Time Years(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Declaration of the ns3::int64x64_t type and associated operators.
Length::Unit Unit
Save some typing by defining a short alias for Length::Unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time Rem(const Time &lhs, const Time &rhs)
Remainder (modulus) from the quotient of two Times.
bool operator!=(Callback< R, Args... > a, Callback< R, Args... > b)
Inequality test.
Time operator%(const Time &lhs, const Time &rhs)
Remainder (modulus) from the quotient of two Times.
bool operator==(const EventId &a, const EventId &b)
std::ostream & operator<<(std::ostream &os, const Angles &a)
Time & operator+=(Time &lhs, const Time &rhs)
Compound addition assignment for Time.
static TimeInitializationHelper g_timeInitHelper
Instance of Time static initialization helper.
std::istream & operator>>(std::istream &is, Angles &a)
bool operator<(const EventId &a, const EventId &b)
Time & operator-=(Time &lhs, const Time &rhs)
Compound subtraction assignment for Time.
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Current time unit, and conversion info.
Time::Unit unit
Current time unit.
Information info[LAST]
Conversion info from current unit.
ns3::TypeNameGet() function declarations.