If you asked for 3 seconds, and then had a task terminating after 2
seconds, the function simulated for 5 seconds.
Now, the time already spent in the loop in previous rounds is properly
taken into account.
Thanks to Guillaume Serrière for detecting the issue.
XBT_DEBUG("Total time: %f", total_time);
- elapsed_time = surf_solve(how_long > 0 ? surf_get_clock() + how_long : -1.0);
+ elapsed_time = surf_solve(how_long > 0 ? surf_get_clock() + how_long - total_time: -1.0);
XBT_DEBUG("surf_solve() returns %f", elapsed_time);
if (elapsed_time > 0.0)
total_time += elapsed_time;