[Ns-bugs] [Bug 104] New: Maximum simulation time
bugzilla-daemon at nsnam-www.ece.gatech.edu
Thu Nov 15 00:59:15 PST 2007
Summary: Maximum simulation time
Component: simulation core
AssignedTo: ns-bugs at isi.edu
ReportedBy: mathieu.lacage at sophia.inria.fr
It is quite common for me to need a way to get the maximum possible simulation
time in my time-calculation algorithms. I have added in my local ns-3 copy a
method named MaxSeconds is nstime.h:
Time MaxSeconds (void);
implemented as such:
Time MaxSeconds (void)
return Timestep (0x7fffffffffffffffLL);
The big tricky thing here is that the internal time can be up to
0xffffffffffffffffLL: note the high bit which is set to 1 here because the
internal time is an unsigned 64 bit quantity. However, the Time class is a
signed quantity so, the Simulator::Now () method actually returns the internal
unsigned time as a signed time.
I think that this means that we should be very careful in our simulator.cc code
to check this condition and make sure that it never happens, that is, that the
simulation time never goes beyond 0x7ffff....
The other issue is how the MaxSeconds function should be named: should it be
named MaxTime instead ? Is there a better alternative to name it ?
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Ns-bugs