OMNeT++ Simulation Library  5.6.1
Simulation Time

Description

The simulation kernel and models use simtime_t to represent simulation time. simtime_t is an alias to the SimTime class that is 64-bit fixed-point representation with a globally shared exponent. This group describes simtime_t, SimTime, and related types and macros.

Classes

class  SimTime
 int64_t-based, base-10 fixed-point simulation time. More...
 

Macros

#define SIMTIME_MAX   omnetpp::SimTime::getMaxTime()
 The maximum representable simulation time with the current resolution. More...
 
#define SIMTIME_ZERO   omnetpp::SimTime::ZERO
 Zero simulation time. More...
 
#define SIMTIME_STR(t)   ((t).str().c_str())
 Convert simtime_t to a C string. More...
 
#define SIMTIME_DBL(t)   ((t).dbl())
 Convert simtime_t to a double. This conversion incurs precision loss. More...
 

Typedefs

typedef SimTime simtime_t
 Represents simulation time. More...
 
typedef const simtime_tsimtime_t_cref
 Constant reference to a simtime_t. More...
 
typedef const double const_simtime_t
 This type must be used for global variables representing simulation time. More...
 

Enumerations

enum  SimTimeUnit
 Enum for simulation time base-10 exponents. More...
 

Macro Definition Documentation

◆ SIMTIME_MAX

#define SIMTIME_MAX   omnetpp::SimTime::getMaxTime()

The maximum representable simulation time with the current resolution.

◆ SIMTIME_ZERO

#define SIMTIME_ZERO   omnetpp::SimTime::ZERO

Zero simulation time.

Using SIMTIME_ZERO can be more efficient than using the 0 constant, especially in non-optimized (debug) builds, because it spares the SimTime constructor call.

Referenced by cIdealChannel::calculateDuration(), cDelayChannel::getTransmissionFinishTime(), cIdealChannel::getTransmissionFinishTime(), and cSimpleModule::send().

◆ SIMTIME_STR

#define SIMTIME_STR (   t)    ((t).str().c_str())

Convert simtime_t to a C string.

◆ SIMTIME_DBL

#define SIMTIME_DBL (   t)    ((t).dbl())

Convert simtime_t to a double. This conversion incurs precision loss.

Typedef Documentation

◆ simtime_t

typedef SimTime simtime_t

Represents simulation time.

◆ simtime_t_cref

typedef const simtime_t& simtime_t_cref

Constant reference to a simtime_t.

In many configurations (e.g. debug builds), it is more efficient to return a SimTime from a function as a const ref than by value.

◆ const_simtime_t

typedef const double const_simtime_t

This type must be used for global variables representing simulation time.

The normal simtime_t type (i.e. SimTime) cannot be used for static variables, because the scale exponent is only available after the configuration has been read by the simulation program. This type is simply an alias of double.

Enumeration Type Documentation

◆ SimTimeUnit

Enum for simulation time base-10 exponents.