INET Framework for OMNeT++/OMNEST
inet::ClockTime Class Reference

This class is a proxy for the SimTime class. More...

#include <ClockTime.h>

Public Member Functions

Constructors
 ClockTime ()
 Constructor initializes to zero. More...
 
 ClockTime (double d)
 Initialize simulation time from a double-precision number. More...
 
 ClockTime (cPar &d)
 Initialize simulation time from a module or channel parameter. More...
 
 ClockTime (int64_t value, SimTimeUnit unit)
 Initialize simulation time from value specified in the given units. More...
 
 ClockTime (const ClockTime &x)
 Copy constructor. More...
 

Static Public Attributes

static const ClockTime ZERO
 Represents the zero simulation time. More...
 

Private Attributes

SimTime impl
 

Arithmetic operations

const ClockTimeoperator= (const ClockTime &x)
 
const ClockTimeoperator= (const cPar &d)
 
const ClockTimeoperator= (double d)
 
const ClockTimeoperator= (short d)
 
const ClockTimeoperator= (int d)
 
const ClockTimeoperator= (long d)
 
const ClockTimeoperator= (long long d)
 
const ClockTimeoperator= (unsigned short d)
 
const ClockTimeoperator= (unsigned int d)
 
const ClockTimeoperator= (unsigned long d)
 
const ClockTimeoperator= (unsigned long long d)
 
bool operator== (const ClockTime &x) const
 
bool operator!= (const ClockTime &x) const
 
bool operator< (const ClockTime &x) const
 
bool operator> (const ClockTime &x) const
 
bool operator<= (const ClockTime &x) const
 
bool operator>= (const ClockTime &x) const
 
ClockTime operator- () const
 
const ClockTimeoperator+= (const ClockTime &x)
 
const ClockTimeoperator-= (const ClockTime &x)
 
const ClockTimeoperator*= (double d)
 
const ClockTimeoperator*= (short d)
 
const ClockTimeoperator*= (int d)
 
const ClockTimeoperator*= (long d)
 
const ClockTimeoperator*= (long long d)
 
const ClockTimeoperator*= (unsigned short d)
 
const ClockTimeoperator*= (unsigned int d)
 
const ClockTimeoperator*= (unsigned long d)
 
const ClockTimeoperator*= (unsigned long long d)
 
const ClockTimeoperator*= (const cPar &p)
 
const ClockTimeoperator/= (double d)
 
const ClockTimeoperator/= (short d)
 
const ClockTimeoperator/= (int d)
 
const ClockTimeoperator/= (long d)
 
const ClockTimeoperator/= (long long d)
 
const ClockTimeoperator/= (unsigned short d)
 
const ClockTimeoperator/= (unsigned int d)
 
const ClockTimeoperator/= (unsigned long d)
 
const ClockTimeoperator/= (unsigned long long d)
 
const ClockTimeoperator/= (const cPar &p)
 
const friend ClockTime operator+ (const ClockTime &x, const ClockTime &y)
 
const friend ClockTime operator- (const ClockTime &x, const ClockTime &y)
 
const friend ClockTime operator* (const ClockTime &x, double d)
 
const friend ClockTime operator* (const ClockTime &x, short d)
 
const friend ClockTime operator* (const ClockTime &x, int d)
 
const friend ClockTime operator* (const ClockTime &x, long d)
 
const friend ClockTime operator* (const ClockTime &x, long long d)
 
const friend ClockTime operator* (const ClockTime &x, unsigned short d)
 
const friend ClockTime operator* (const ClockTime &x, unsigned int d)
 
const friend ClockTime operator* (const ClockTime &x, unsigned long d)
 
const friend ClockTime operator* (const ClockTime &x, unsigned long long d)
 
const friend ClockTime operator* (const ClockTime &x, const cPar &p)
 
const friend ClockTime operator* (double d, const ClockTime &x)
 
const friend ClockTime operator* (short d, const ClockTime &x)
 
const friend ClockTime operator* (int d, const ClockTime &x)
 
const friend ClockTime operator* (long d, const ClockTime &x)
 
const friend ClockTime operator* (long long d, const ClockTime &x)
 
const friend ClockTime operator* (unsigned short d, const ClockTime &x)
 
const friend ClockTime operator* (unsigned int d, const ClockTime &x)
 
const friend ClockTime operator* (unsigned long d, const ClockTime &x)
 
const friend ClockTime operator* (unsigned long long d, const ClockTime &x)
 
const friend ClockTime operator* (const cPar &p, const ClockTime &x)
 
const friend ClockTime operator/ (const ClockTime &x, double d)
 
const friend ClockTime operator/ (const ClockTime &x, short d)
 
const friend ClockTime operator/ (const ClockTime &x, int d)
 
const friend ClockTime operator/ (const ClockTime &x, long d)
 
const friend ClockTime operator/ (const ClockTime &x, long long d)
 
const friend ClockTime operator/ (const ClockTime &x, unsigned short d)
 
const friend ClockTime operator/ (const ClockTime &x, unsigned int d)
 
const friend ClockTime operator/ (const ClockTime &x, unsigned long d)
 
const friend ClockTime operator/ (const ClockTime &x, unsigned long long d)
 
const friend ClockTime operator/ (const ClockTime &x, const cPar &p)
 
double operator/ (const ClockTime &x, const ClockTime &y)
 
double operator/ (double x, const ClockTime &y)
 
double operator/ (short x, const ClockTime &y)
 
double operator/ (int x, const ClockTime &y)
 
double operator/ (long x, const ClockTime &y)
 
double operator/ (long long x, const ClockTime &y)
 
double operator/ (unsigned short x, const ClockTime &y)
 
double operator/ (unsigned int x, const ClockTime &y)
 
double operator/ (unsigned long x, const ClockTime &y)
 
double operator/ (unsigned long long x, const ClockTime &y)
 
double operator/ (const cPar &p, const ClockTime &x)
 

Misc operations and utilities

SimTime asSimTime () const
 Convert to SimTime. More...
 
bool isZero () const
 Returns true if this simulation time is zero, false otherwise. More...
 
double dbl () const
 Converts simulation time (in seconds) to a double. More...
 
int64_t inUnit (SimTimeUnit unit) const
 Converts the simulation time to the given time unit, discarding the fractional part (i.e. More...
 
ClockTime trunc (SimTimeUnit unit) const
 Returns a new simulation time that is truncated (rounded towards zero) to the precision of the specified time unit. More...
 
ClockTime remainderForUnit (SimTimeUnit unit) const
 Returns a simtime that is the difference between the simulation time and its truncated value (see trunc()). More...
 
void split (SimTimeUnit unit, int64_t &outValue, ClockTime &outRemainder) const
 Convenience method: splits the simulation time into a whole and a fractional part with regard to a time unit. More...
 
std::string str () const
 Converts the time to a numeric string. More...
 
char * str (char *buf) const
 Converts to a string in the same way as str() does. More...
 
std::string ustr () const
 Converts the time to a numeric string with unit in the same format as ustr(SimTimeUnit) does, but chooses the time unit automatically. More...
 
std::string ustr (SimTimeUnit unit) const
 Converts the time to a numeric string in the given time unit. More...
 
int64_t raw () const
 Returns the underlying 64-bit integer. More...
 
const ClockTimesetRaw (int64_t l)
 Directly sets the underlying 64-bit integer. More...
 
static ClockTime from (SimTime t)
 Convert from SimTime. More...
 
static const ClockTime getMaxTime ()
 Returns the largest simulation time that can be represented using the present scale exponent. More...
 
static int64_t getScale ()
 Returns the time resolution as the number of units per second, e.g. More...
 
static int getScaleExp ()
 Returns the scale exponent, which is an integer in the range -18..0. More...
 
static const ClockTime parse (const char *s)
 Converts the given string to simulation time. More...
 
static const ClockTime parse (const char *s, const char *&endp)
 Converts a prefix of the given string to simulation time, up to the first character that cannot occur in simulation time strings: not (digit or letter or "." or "+" or "-" or whitespace). More...
 
static char * ttoa (char *buf, int64_t impl, int scaleexp, char *&endp)
 Utility function to convert a 64-bit fixed point number into a string buffer. More...
 

Detailed Description

This class is a proxy for the SimTime class.

The reason behind this design is that the simulation time and the clock time must not be confused. So this class doesn't have implicit conversion operators to and from the simulation time.

Constructor & Destructor Documentation

◆ ClockTime() [1/5]

inet::ClockTime::ClockTime ( )
inline

Constructor initializes to zero.

40 {}

◆ ClockTime() [2/5]

inet::ClockTime::ClockTime ( double  d)
inline

Initialize simulation time from a double-precision number.

This constructor is recommended if the value is the result of some computation done in double. For integer-based computations and time constants, the ClockTime(int64_t x, int exponent) constructor is usually a better choice, because it does not have rounding errors caused by double-to-integer conversion.

50 { operator=(d); }

◆ ClockTime() [3/5]

inet::ClockTime::ClockTime ( cPar &  d)
inline

Initialize simulation time from a module or channel parameter.

It uses conversion to double. It currently does not check the measurement unit of the parameter (@unit NED property), although this may change in future releases.

58 { operator=(d); }

◆ ClockTime() [4/5]

inet::ClockTime::ClockTime ( int64_t  value,
SimTimeUnit  unit 
)
inline

Initialize simulation time from value specified in the given units.

This constructor allows one to specify precise constants, without conversion errors incurred by the double constructor. An error will be thrown if the resulting value cannot be represented (overflow) or it cannot be represented precisely (precision loss) with the current resolution (i.e. scale exponent). Note that the unit parameter actually represents a base-10 exponent, so the constructor will also work correctly for values not in the SimTimeUnit enum.

Examples: Simtime(15, SIMTIME_US) -> 15us Simtime(-3, SIMTIME_S) -> -1s Simtime(5, (SimTimeUnit)2) -> 500s;

75 : impl(value, unit) {}

◆ ClockTime() [5/5]

inet::ClockTime::ClockTime ( const ClockTime x)
inline

Copy constructor.

80 : impl(x.impl) {}

Member Function Documentation

◆ asSimTime()

SimTime inet::ClockTime::asSimTime ( ) const
inline

Convert to SimTime.

190 { return impl; }

Referenced by inet::IdealClock::computeSimTimeFromClockTime(), and inet::SettableClock::setClockTime().

◆ dbl()

double inet::ClockTime::dbl ( ) const
inline

Converts simulation time (in seconds) to a double.

Note that conversion to and from double may lose precision. We do not provide implicit conversion to double as it would conflict with other overloaded operators, and would cause ambiguities during compilation.

205 { return impl.dbl(); }

Referenced by inet::EligibilityTimeMeter::emitNumTokenChangedSignal(), inet::PacketTransmitterBase::encodePacket(), inet::StreamThroughTransmitter::progressTx(), inet::visualizer::GateScheduleCanvasVisualizer::refreshGateVisualization(), and inet::StreamingTransmitterBase::scheduleAt().

◆ from()

static ClockTime inet::ClockTime::from ( SimTime  t)
inlinestatic

Convert from SimTime.

185 { ClockTime tmp; tmp.impl = t; return tmp; }

Referenced by inet::IdealClock::computeClockTimeFromSimTime(), and inet::OscillatorBasedClock::computeClockTimeFromSimTime().

◆ getMaxTime()

static const ClockTime inet::ClockTime::getMaxTime ( )
inlinestatic

Returns the largest simulation time that can be represented using the present scale exponent.

296 { return from(SimTime::getMaxTime()); }

◆ getScale()

static int64_t inet::ClockTime::getScale ( )
inlinestatic

Returns the time resolution as the number of units per second, e.g.

for microsecond resolution it returns 1000000.

302 { return SimTime::getScale(); }

◆ getScaleExp()

static int inet::ClockTime::getScaleExp ( )
inlinestatic

Returns the scale exponent, which is an integer in the range -18..0.

For example, for microsecond resolution it returns -6.

308 { return SimTime::getScaleExp(); }

Referenced by inet::operator<<().

◆ inUnit()

int64_t inet::ClockTime::inUnit ( SimTimeUnit  unit) const
inline

Converts the simulation time to the given time unit, discarding the fractional part (i.e.

rounding towards zero). If the return type is not wide enough to hold the result, an error will be thrown.

Examples: 1.7ms in us --> 1700; 3.8ms in s --> 3; -3.8ms in s --> -3; 999ms in s --> 0

218 { return impl.inUnit(unit); }

◆ isZero()

bool inet::ClockTime::isZero ( ) const
inline

Returns true if this simulation time is zero, false otherwise.

This is more efficient than comparing the variable to a (double) 0.0, and shorter than comparing against ClockTime::ZERO.

197 { return impl.isZero(); }

◆ operator!=()

bool inet::ClockTime::operator!= ( const ClockTime x) const
inline
98 { return impl != x.impl; }

◆ operator*=() [1/10]

const ClockTime& inet::ClockTime::operator*= ( const cPar &  p)
inline
120 { impl *= p; return *this; }

◆ operator*=() [2/10]

const ClockTime& inet::ClockTime::operator*= ( double  d)
inline
111 { impl *= d; return *this; }

◆ operator*=() [3/10]

const ClockTime& inet::ClockTime::operator*= ( int  d)
inline
113 { impl *= d; return *this; }

◆ operator*=() [4/10]

const ClockTime& inet::ClockTime::operator*= ( long  d)
inline
114 { impl *= d; return *this; }

◆ operator*=() [5/10]

const ClockTime& inet::ClockTime::operator*= ( long long  d)
inline
115 { impl *= d; return *this; }

◆ operator*=() [6/10]

const ClockTime& inet::ClockTime::operator*= ( short  d)
inline
112 { impl *= d; return *this; }

◆ operator*=() [7/10]

const ClockTime& inet::ClockTime::operator*= ( unsigned int  d)
inline
117 { impl *= d; return *this; }

◆ operator*=() [8/10]

const ClockTime& inet::ClockTime::operator*= ( unsigned long  d)
inline
118 { impl *= d; return *this; }

◆ operator*=() [9/10]

const ClockTime& inet::ClockTime::operator*= ( unsigned long long  d)
inline
119 { impl *= d; return *this; }

◆ operator*=() [10/10]

const ClockTime& inet::ClockTime::operator*= ( unsigned short  d)
inline
116 { impl *= d; return *this; }

◆ operator+=()

const ClockTime& inet::ClockTime::operator+= ( const ClockTime x)
inline
106 { impl += x.impl; return *this; }

◆ operator-()

ClockTime inet::ClockTime::operator- ( ) const
inline
104 { return from(-impl); }

◆ operator-=()

const ClockTime& inet::ClockTime::operator-= ( const ClockTime x)
inline
107 { impl -= x.impl; return *this; }

◆ operator/=() [1/10]

const ClockTime& inet::ClockTime::operator/= ( const cPar &  p)
inline
131 { impl /= p; return *this; }

◆ operator/=() [2/10]

const ClockTime& inet::ClockTime::operator/= ( double  d)
inline
122 { impl /= d; return *this; }

◆ operator/=() [3/10]

const ClockTime& inet::ClockTime::operator/= ( int  d)
inline
124 { impl /= d; return *this; }

◆ operator/=() [4/10]

const ClockTime& inet::ClockTime::operator/= ( long  d)
inline
125 { impl /= d; return *this; }

◆ operator/=() [5/10]

const ClockTime& inet::ClockTime::operator/= ( long long  d)
inline
126 { impl /= d; return *this; }

◆ operator/=() [6/10]

const ClockTime& inet::ClockTime::operator/= ( short  d)
inline
123 { impl /= d; return *this; }

◆ operator/=() [7/10]

const ClockTime& inet::ClockTime::operator/= ( unsigned int  d)
inline
128 { impl /= d; return *this; }

◆ operator/=() [8/10]

const ClockTime& inet::ClockTime::operator/= ( unsigned long  d)
inline
129 { impl /= d; return *this; }

◆ operator/=() [9/10]

const ClockTime& inet::ClockTime::operator/= ( unsigned long long  d)
inline
130 { impl /= d; return *this; }

◆ operator/=() [10/10]

const ClockTime& inet::ClockTime::operator/= ( unsigned short  d)
inline
127 { impl /= d; return *this; }

◆ operator<()

bool inet::ClockTime::operator< ( const ClockTime x) const
inline
99 { return impl < x.impl; }

◆ operator<=()

bool inet::ClockTime::operator<= ( const ClockTime x) const
inline
101 { return impl <= x.impl; }

◆ operator=() [1/11]

const ClockTime& inet::ClockTime::operator= ( const ClockTime x)
inline
85 { impl = x.impl; return *this; }

◆ operator=() [2/11]

const ClockTime& inet::ClockTime::operator= ( const cPar &  d)
inline
86 { impl = d; return *this; }

◆ operator=() [3/11]

const ClockTime& inet::ClockTime::operator= ( double  d)
inline
87 { impl = d; return *this; }

◆ operator=() [4/11]

const ClockTime& inet::ClockTime::operator= ( int  d)
inline
89 { impl = d; return *this; }

◆ operator=() [5/11]

const ClockTime& inet::ClockTime::operator= ( long  d)
inline
90 { impl = d; return *this; }

◆ operator=() [6/11]

const ClockTime& inet::ClockTime::operator= ( long long  d)
inline
91 { impl = d; return *this; }

◆ operator=() [7/11]

const ClockTime& inet::ClockTime::operator= ( short  d)
inline
88 { impl = d; return *this; }

◆ operator=() [8/11]

const ClockTime& inet::ClockTime::operator= ( unsigned int  d)
inline
93 { impl = d; return *this; }

◆ operator=() [9/11]

const ClockTime& inet::ClockTime::operator= ( unsigned long  d)
inline
94 { impl = d; return *this; }

◆ operator=() [10/11]

const ClockTime& inet::ClockTime::operator= ( unsigned long long  d)
inline
95 { impl = d; return *this; }

◆ operator=() [11/11]

const ClockTime& inet::ClockTime::operator= ( unsigned short  d)
inline
92 { impl = d; return *this; }

◆ operator==()

bool inet::ClockTime::operator== ( const ClockTime x) const
inline
97 { return impl == x.impl; }

◆ operator>()

bool inet::ClockTime::operator> ( const ClockTime x) const
inline
100 { return impl > x.impl; }

◆ operator>=()

bool inet::ClockTime::operator>= ( const ClockTime x) const
inline
102 { return impl >= x.impl; }

◆ parse() [1/2]

static const ClockTime inet::ClockTime::parse ( const char *  s)
inlinestatic

Converts the given string to simulation time.

Throws an error if there is an error during conversion. Accepted format is: <number> or (<number><unit>)+.

315 { return from(SimTime::parse(s)); }

Referenced by inet::SettableClock::processCommand().

◆ parse() [2/2]

static const ClockTime inet::ClockTime::parse ( const char *  s,
const char *&  endp 
)
inlinestatic

Converts a prefix of the given string to simulation time, up to the first character that cannot occur in simulation time strings: not (digit or letter or "." or "+" or "-" or whitespace).

Throws an error if there is an error during conversion of the prefix. If the prefix is empty (whitespace only), then 0 is returned, and endp is set equal to s; otherwise, endp is set to point to the first character that was not converted.

326 { return from(SimTime::parse(s, endp)); }

◆ raw()

◆ remainderForUnit()

ClockTime inet::ClockTime::remainderForUnit ( SimTimeUnit  unit) const
inline

Returns a simtime that is the difference between the simulation time and its truncated value (see trunc()).

That is, t == t.trunc(unit) + t.remainderforUnit(unit) for any unit.

236 { return from(impl.remainderForUnit(unit)); }

◆ setRaw()

const ClockTime& inet::ClockTime::setRaw ( int64_t  l)
inline

Directly sets the underlying 64-bit integer.

290 { impl.setRaw(l); return *this; }

Referenced by inet::InterpacketGapInserter::initialize(), inet::EligibilityTimeMeter::meterPacket(), and setRaw().

◆ split()

void inet::ClockTime::split ( SimTimeUnit  unit,
int64_t &  outValue,
ClockTime outRemainder 
) const
inline

Convenience method: splits the simulation time into a whole and a fractional part with regard to a time unit.

t.split(exponent, outValue, outRemainder) is equivalent to:

outValue = t.inUnit(unit);
outRemainder = t.remainderForUnit(unit);
248 { impl.split(unit, outValue, outRemainder.impl); }

◆ str() [1/2]

std::string inet::ClockTime::str ( ) const
inline

Converts the time to a numeric string.

The number expresses the simulation time precisely (including all significant digits), in seconds. The measurement unit (seconds) is not part of the string.

255 { return impl.str(); }

Referenced by inet::ClockBase::resolveDirective().

◆ str() [2/2]

char* inet::ClockTime::str ( char *  buf) const
inline

Converts to a string in the same way as str() does.

Use this variant over str() where performance is critical. The result is placed somewhere in the given buffer (pointer is returned), but for performance reasons, not necessarily at the buffer's beginning. Please read the documentation of ttoa() for the minimum required buffer size.

264 { return impl.str(buf); }

◆ trunc()

ClockTime inet::ClockTime::trunc ( SimTimeUnit  unit) const
inline

Returns a new simulation time that is truncated (rounded towards zero) to the precision of the specified time unit.

Examples: 3750ms truncated to s --> 3; -3750ms truncated to s --> -3

228 { return from(impl.trunc(unit)); }

◆ ttoa()

static char* inet::ClockTime::ttoa ( char *  buf,
int64_t  impl,
int  scaleexp,
char *&  endp 
)
inlinestatic

Utility function to convert a 64-bit fixed point number into a string buffer.

scaleexp must be in the -18..0 range, and the buffer must be at least 64 bytes long. A pointer to the result string will be returned. A pointer to the terminating '\0' will be returned in endp.

ATTENTION: For performance reasons, the returned pointer will point somewhere into the buffer, but NOT necessarily at the beginning.

337 { return SimTime::ttoa(buf, impl, scaleexp, endp); }

Referenced by inet::operator<<().

◆ ustr() [1/2]

std::string inet::ClockTime::ustr ( ) const
inline

Converts the time to a numeric string with unit in the same format as ustr(SimTimeUnit) does, but chooses the time unit automatically.

The function tries to choose the "natural" time unit, e.g. 0.0033 is returned as "3.3ms".

272 { return impl.ustr(); }

Referenced by inet::StreamingTransmitterBase::scheduleTxEndTimer().

◆ ustr() [2/2]

std::string inet::ClockTime::ustr ( SimTimeUnit  unit) const
inline

Converts the time to a numeric string in the given time unit.

The unit can be "s", "ms", "us", "ns", "ps", "fs", or "as". The result represents the simulation time precisely (includes all significant digits), and the unit is appended.

280 { return impl.ustr(unit); }

Friends And Related Function Documentation

◆ operator* [1/20]

const friend ClockTime operator* ( const ClockTime x,
const cPar &  p 
)
friend
142 { return from(x.impl * p); }

◆ operator* [2/20]

const friend ClockTime operator* ( const ClockTime x,
double  d 
)
friend
133 { return from(x.impl * d); }

◆ operator* [3/20]

const friend ClockTime operator* ( const ClockTime x,
int  d 
)
friend
135 { return from(x.impl * d); }

◆ operator* [4/20]

const friend ClockTime operator* ( const ClockTime x,
long  d 
)
friend
136 { return from(x.impl * d); }

◆ operator* [5/20]

const friend ClockTime operator* ( const ClockTime x,
long long  d 
)
friend
137 { return from(x.impl * d); }

◆ operator* [6/20]

const friend ClockTime operator* ( const ClockTime x,
short  d 
)
friend
134 { return from(x.impl * d); }

◆ operator* [7/20]

const friend ClockTime operator* ( const ClockTime x,
unsigned int  d 
)
friend
139 { return from(x.impl * d); }

◆ operator* [8/20]

const friend ClockTime operator* ( const ClockTime x,
unsigned long  d 
)
friend
140 { return from(x.impl * d); }

◆ operator* [9/20]

const friend ClockTime operator* ( const ClockTime x,
unsigned long long  d 
)
friend
141 { return from(x.impl * d); }

◆ operator* [10/20]

const friend ClockTime operator* ( const ClockTime x,
unsigned short  d 
)
friend
138 { return from(x.impl * d); }

◆ operator* [11/20]

const friend ClockTime operator* ( const cPar &  p,
const ClockTime x 
)
friend
153 { return from(p * x.impl); }

◆ operator* [12/20]

const friend ClockTime operator* ( double  d,
const ClockTime x 
)
friend
144 { return from(d * x.impl); }

◆ operator* [13/20]

const friend ClockTime operator* ( int  d,
const ClockTime x 
)
friend
146 { return from(d * x.impl); }

◆ operator* [14/20]

const friend ClockTime operator* ( long  d,
const ClockTime x 
)
friend
147 { return from(d * x.impl); }

◆ operator* [15/20]

const friend ClockTime operator* ( long long  d,
const ClockTime x 
)
friend
148 { return from(d * x.impl); }

◆ operator* [16/20]

const friend ClockTime operator* ( short  d,
const ClockTime x 
)
friend
145 { return from(d * x.impl); }

◆ operator* [17/20]

const friend ClockTime operator* ( unsigned int  d,
const ClockTime x 
)
friend
150 { return from(d * x.impl); }

◆ operator* [18/20]

const friend ClockTime operator* ( unsigned long  d,
const ClockTime x 
)
friend
151 { return from(d * x.impl); }

◆ operator* [19/20]

const friend ClockTime operator* ( unsigned long long  d,
const ClockTime x 
)
friend
152 { return from(d * x.impl); }

◆ operator* [20/20]

const friend ClockTime operator* ( unsigned short  d,
const ClockTime x 
)
friend
149 { return from(d * x.impl); }

◆ operator+

const friend ClockTime operator+ ( const ClockTime x,
const ClockTime y 
)
friend
108 { return ClockTime(x) += y; }

◆ operator-

const friend ClockTime operator- ( const ClockTime x,
const ClockTime y 
)
friend
109 { return ClockTime(x) -= y; }

◆ operator/ [1/21]

double operator/ ( const ClockTime x,
const ClockTime y 
)
friend
166 { return x.impl / y.impl; }

◆ operator/ [2/21]

const friend ClockTime operator/ ( const ClockTime x,
const cPar &  p 
)
friend
164 { return from(x.impl / p); }

◆ operator/ [3/21]

const friend ClockTime operator/ ( const ClockTime x,
double  d 
)
friend
155 { return from(x.impl / d); }

◆ operator/ [4/21]

const friend ClockTime operator/ ( const ClockTime x,
int  d 
)
friend
157 { return from(x.impl / d); }

◆ operator/ [5/21]

const friend ClockTime operator/ ( const ClockTime x,
long  d 
)
friend
158 { return from(x.impl / d); }

◆ operator/ [6/21]

const friend ClockTime operator/ ( const ClockTime x,
long long  d 
)
friend
159 { return from(x.impl / d); }

◆ operator/ [7/21]

const friend ClockTime operator/ ( const ClockTime x,
short  d 
)
friend
156 { return from(x.impl / d); }

◆ operator/ [8/21]

const friend ClockTime operator/ ( const ClockTime x,
unsigned int  d 
)
friend
161 { return from(x.impl / d); }

◆ operator/ [9/21]

const friend ClockTime operator/ ( const ClockTime x,
unsigned long  d 
)
friend
162 { return from(x.impl / d); }

◆ operator/ [10/21]

const friend ClockTime operator/ ( const ClockTime x,
unsigned long long  d 
)
friend
163 { return from(x.impl / d); }

◆ operator/ [11/21]

const friend ClockTime operator/ ( const ClockTime x,
unsigned short  d 
)
friend
160 { return from(x.impl / d); }

◆ operator/ [12/21]

double operator/ ( const cPar &  p,
const ClockTime x 
)
friend
177 { return p / x.impl; }

◆ operator/ [13/21]

double operator/ ( double  x,
const ClockTime y 
)
friend
168 { return x / y.impl; }

◆ operator/ [14/21]

double operator/ ( int  x,
const ClockTime y 
)
friend
170 { return x / y.impl; }

◆ operator/ [15/21]

double operator/ ( long long  x,
const ClockTime y 
)
friend
172 { return x / y.impl; }

◆ operator/ [16/21]

double operator/ ( long  x,
const ClockTime y 
)
friend
171 { return x / y.impl; }

◆ operator/ [17/21]

double operator/ ( short  x,
const ClockTime y 
)
friend
169 { return x / y.impl; }

◆ operator/ [18/21]

double operator/ ( unsigned int  x,
const ClockTime y 
)
friend
174 { return x / y.impl; }

◆ operator/ [19/21]

double operator/ ( unsigned long long  x,
const ClockTime y 
)
friend
176 { return x / y.impl; }

◆ operator/ [20/21]

double operator/ ( unsigned long  x,
const ClockTime y 
)
friend
175 { return x / y.impl; }

◆ operator/ [21/21]

double operator/ ( unsigned short  x,
const ClockTime y 
)
friend
173 { return x / y.impl; }

Member Data Documentation

◆ impl

SimTime inet::ClockTime::impl
private

◆ ZERO

const ClockTime inet::ClockTime::ZERO
static

Represents the zero simulation time.

Using ClockTime::ZERO may be faster than writing ClockTime() or conversion from 0.0, because the constructor call is spared.


The documentation for this class was generated from the following files:
inet::ClockTime::from
static ClockTime from(SimTime t)
Convert from SimTime.
Definition: common/ClockTime.h:185
inet::ClockTime::ClockTime
ClockTime()
Constructor initializes to zero.
Definition: common/ClockTime.h:40
inet::ClockTime::operator=
const ClockTime & operator=(const ClockTime &x)
Definition: common/ClockTime.h:85
inet::units::values::s
value< double, units::s > s
Definition: Units.h:1235
inet::units::unit
pow< internal::none, 0 > unit
Definition: Units.h:72
inet::ClockTime::impl
SimTime impl
Definition: common/ClockTime.h:24