[Ns-developers] Application::Start/Stop, time parameter inconsistent with Simulator::Schedule

craigdo@ee.washington.edu craigdo at ee.washington.edu
Tue May 27 23:59:17 PDT 2008


> Application::Start/Stop() accept absolute time, while
> Simulator::Schedule accepts relative time...

[ ... ]

> 
> We already have an example for naming an absolute time event: 
> Simulator::StopAt();
> 
> Would Application::StartAt() and Application::StopAt() make 
> it more clear?

Yes, I think it's is more clear.  It's not the most clear thing to do,
though.

In English, we talk about doing something *at* a wall clock time as an
absolute time (e.g., returning from lunch *at* 1 o'clock or *at* 1 PM or
*at* 13h00); and we talk about doing something *in* some number of seconds,
minutes, etc., as a relative time (e.g., returning from lunch *in* 1 hour or
*in* 30 minutes).  The preposition and the units agree.

In the case of StartAt() we obviously want to schedule a start *at* five
seconds.  I think it is natural to assume that this means, "start at five
seconds on the simulation wall clock."  However, I can imagine someone who
has been doing relative time schedule calls all day thinking, "start at five
seconds in the future."

The pedant in me says that the answer is Simulator::StopAt (Seconds (5.)),
Simulator::ScheduleIn (Seconds (1.)), Application::StartAt (Seconds (0.)),
Application::StartIn (Seconds (10.)).

The realist in me says that is silly and overly pedantic.  I think to
myself, if everything to do with scheduling events is in relative time, it'd
be hard to confuse the one possible option with itself (although I could
probably manage :-).

So I think the simple, straightforward, easy to remember and use thing is to
go with calls like:

Application::Start (Seconds (5.)) means start *in* five seconds (relative).
If you do this before the simulation starts it means start in five seconds
once the simulation starts.  Simulator::Stop (Seconds (5.)) means stop the
simulation in five seconds (relative).  If you do this before the simulation
starts it does what StopAt does now.  Etc., etc.

It's hard to get too excited about this, though.

-- Craig




More information about the Ns-developers mailing list