99    static bool firstTime = 
true;
 
  132    std::string::size_type n = s.find_first_not_of(
"+-0123456789.eE");
 
  133    if (n != std::string::npos)
 
  135        std::istringstream iss;
 
  136        iss.str(s.substr(0, n));
 
  139        std::string trailer = s.substr(n, std::string::npos);
 
  144        else if (trailer == 
"ms")
 
  148        else if (trailer == 
"us")
 
  152        else if (trailer == 
"ns")
 
  156        else if (trailer == 
"ps")
 
  160        else if (trailer == 
"fs")
 
  164        else if (trailer == 
"min")
 
  168        else if (trailer == 
"h")
 
  172        else if (trailer == 
"d")
 
  176        else if (trailer == 
"y")
 
  188        std::istringstream iss;
 
  233        int shift = UNIT_POWER[i] - UNIT_POWER[(int)unit];
 
  235        if (UNIT_COEFF[i] > UNIT_COEFF[(
int)unit])
 
  237            quotient = UNIT_COEFF[i] / UNIT_COEFF[(int)unit];
 
  238            NS_ASSERT(quotient * UNIT_COEFF[(
int)unit] == UNIT_COEFF[i]);
 
  240        else if (UNIT_COEFF[i] < UNIT_COEFF[(
int)unit])
 
  242            quotient = UNIT_COEFF[(int)unit] / UNIT_COEFF[i];
 
  243            NS_ASSERT(quotient * UNIT_COEFF[i] == UNIT_COEFF[(
int)unit]);
 
  245        NS_LOG_DEBUG(
"SetResolution for unit " << (
int)unit << 
" loop iteration " << i
 
  246                                               << 
" has shift " << shift << 
" has quotient " 
  250        if ((std::pow(10, std::fabs(shift)) * quotient) >
 
  251            static_cast<double>(std::numeric_limits<int64_t>::max()))
 
  253            NS_LOG_DEBUG(
"SetResolution for unit " << (
int)unit << 
" loop iteration " << i
 
  254                                                   << 
" marked as INVALID");
 
  258        int64_t factor = 
static_cast<int64_t
>(std::pow(10, std::fabs(shift)) * quotient);
 
  259        double realFactor = std::pow(10, (
double)shift) * 
static_cast<double>(UNIT_COEFF[i]) /
 
  260                            UNIT_COEFF[(
int)unit];
 
  261        NS_LOG_DEBUG(
"SetResolution factor " << factor << 
" real factor " << realFactor);
 
  265        if (shift == 0 && quotient == 1)
 
  273        else if (realFactor > 1)
 
  291    resolution->
unit = unit;
 
  336        std::pair<MarkedTimes::iterator, bool> ret;
 
  360                      "Time object " << time << 
" registered " << 
g_markingTimes->count(time)
 
  361                                     << 
" times (should be 1).");
 
  366            NS_LOG_WARN(
"unexpected result erasing " << time << 
"!");
 
  385                  "No MarkedTimes registry. " 
  386                  "Time::SetResolution () called more than once?");
 
  390        Time* 
const tp = *it;
 
  391        if (!(tp->
m_data == std::numeric_limits<int64_t>::min() ||
 
  392              tp->
m_data == std::numeric_limits<int64_t>::max()))
 
  442        while (u != 
Time::LAST && UNIT_VALUE[u] > value)
 
  490        label = 
"unreachable";
 
  502    std::ios_base::fmtflags ff = os.flags();
 
  504    os << std::showpos << std::right << v << label;
 
  507    if (!(ff & std::ios_base::showpos))
 
  509        os << std::noshowpos;
 
  511    if (ff & std::ios_base::left)
 
  515    else if (ff & std::ios_base::internal)
 
  541        Checker(
const Time minValue, 
const Time maxValue)
 
  542            : m_minValue(minValue),
 
  555            return v->
Get() >= m_minValue && v->
Get() <= m_maxValue;
 
  558        std::string GetValueTypeName()
 const override 
  561            return "ns3::TimeValue";
 
  564        bool HasUnderlyingTypeInformation()
 const override 
  570        std::string GetUnderlyingTypeInformation()
 const override 
  573            std::ostringstream oss;
 
  575                << 
" " << m_minValue << 
":" << m_maxValue;
 
  582            return ns3::Create<TimeValue>();
 
  590            if (src == 
nullptr || dst == 
nullptr)
 
  600    }* checker = 
new Checker(
min, 
max);
 
NS_ABORT_x macro definitions.
 
Represent the type of an attribute.
 
Hold a value for an Attribute.
 
Smart pointer class similar to boost::intrusive_ptr.
 
Simulation virtual time values and global simulation resolution.
 
static void ClearMarkedTimes()
Remove all MarkedTimes.
 
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.
 
static void ConvertTimes(const Unit unit)
Convert existing Times to the new unit.
 
static Unit GetResolution()
 
static bool StaticInit()
Function to force static initialization of Time.
 
static void Clear(Time *const time)
Remove a Time instance from the MarkedTimes, called by ~Time().
 
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.
 
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.
 
static Resolution * PeekResolution()
Get the current Resolution.
 
static void Mark(Time *const time)
Record a Time instance with the MarkedTimes.
 
static void SetResolution(Unit resolution)
 
int64_t ToInteger(Unit unit) const
Get the Time value expressed in a particular unit.
 
static Time FromDouble(double value, Unit unit)
Create a Time equal to value in unit unit.
 
double ToDouble(Unit unit) const
Get the Time value expressed in a particular unit.
 
int64_t GetTimeStep() const
Get the raw time value, in the current resolution unit.
 
std::set< Time * > MarkedTimes
Record all instances of Time, so we can rescale them when the resolution changes.
 
AttributeValue implementation for Time.
 
A Time with attached unit, to facilitate output in that unit.
 
Time::Unit m_unit
The unit to use in output.
 
High precision numerical type, implementing Q64.64 fixed precision.
 
static int64x64_t Invert(const uint64_t v)
Compute the inverse of an integer value.
 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
 
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
 
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
 
#define ATTRIBUTE_VALUE_IMPLEMENT(type)
Define the class methods belonging to attribute value class typeValue for class type.
 
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
 
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
 
#define NS_LOG_COMPONENT_DEFINE_MASK(name, mask)
Define a logging component with a mask.
 
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
 
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
 
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
 
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
 
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
 
const long double * UNIT_VALUE
Value of each unit, in terms of the smallest defined unit.
 
const int32_t UNIT_COEFF[Time::LAST]
Scaling coefficient, relative to smallest unit.
 
const int8_t UNIT_POWER[Time::LAST]
Scaling coefficients, exponents, and look up table for unit.
 
long double * InitUnitValue()
Initializer for UNIT_VALUE.
 
long double Scale(Time::Unit u)
Scale a unit to the smallest unit.
 
Every class exported by the ns3 library is enclosed in the ns3 namespace.
 
std::ostream & operator<<(std::ostream &os, const Angles &a)
 
std::istream & operator>>(std::istream &is, Angles &a)
 
Ptr< T > Copy(Ptr< T > object)
Return a deep copy of a Ptr.
 
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
 
static std::mutex g_markingMutex
The static mutex for critical sections around modification of Time::g_markingTimes.
 
Declaration of classes ns3::Time and ns3::TimeWithUnit, and the TimeValue implementation classes.
 
Current time unit, and conversion info.
 
Time::Unit unit
Current time unit.
 
Information info[LAST]
Conversion info from current unit.