[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scheduler.cc - negative time-travel ?




Unless I am mistaken, it seems that
scheduler.cc allows events to be scheduled
in the "past". That is  s.schedule( x, y, t) can be called with t
being negative. When this event gets scheduled, the simulation time
travels backwards (as t was negative).

Is this feature deliberate or just an oversight ?

I discovered this while trying to debug ns-2/ll.cc.
It was scheduling an &intr after a negative interval - the scheduler
does not complain. However, one side-effect of this is that
the event times in the trace files are no more  non-decreasing.
This is, to say the least, very annoying, and can perhaps yield
erroneous results (by re-ordering events in a non-causal order).

I would suggest adding a check (and warning) for (clock_ <= t) in
Scheduler::dispatch(p,t) -- may be assert(clock_<=t).
This would help in catching some bugs.

- nitin