how to get simulation time

16 views
Skip to first unread message

Edd Drusti

unread,
Jul 14, 2009, 7:23:44 AM7/14/09
to omnetpp
How can I get the simulation time in any module?
In the class SimTime is no method that gets simulation time?!

I need to define a variable (of type simtime_t or similar) and then
get the simulation time before/after some event occured.

I need something like this:

simtime_t mytime;

event x;
mytime = getSimTime();
...

event y;
timedifference=getSimTime()-mytime;
EV << "Time difference is:" + timedifference +" s \n";

Thanks

Rudolf Hornig

unread,
Jul 14, 2009, 8:22:58 AM7/14/09
to omn...@googlegroups.com
You almost got it (see the documentation for cSimpleModule):

mytime = simTime();

Edd Drusti

unread,
Jul 14, 2009, 9:04:35 AM7/14/09
to omnetpp
:-)

Thanks anyway Rudolph.


On 14 Jul., 14:22, Rudolf Hornig <rudolf.hor...@gmail.com> wrote:
> You almost got it (see the documentation for cSimpleModule):
>
> mytime = *simTime()*;
Reply all
Reply to author
Forward
0 new messages