Here is a little 3-line code snippet that does not behave the way I would expect it to. This doesn't mean I'm not at fault, but I just don't see why it should behave like this.

// (normal headers go here)

var end_time;

function main()
{
wait(-1);
wait(-1);
end_time = total_secs;
} // place a breakpoint here...

So I add a watch for "end_time" and set a breakpoint on the last line of the program - the closing brace (see comment). Then I run the program in debug mode - end_time will either be 3.0 or 4.0 seconds, but never 2.0 as I would expect.

You might think that this is because of setup time or debug overhead, but if you comment out one of the "wait(-1);" statements, end_time is always 1.0. In 30 or 40 runs I never saw a different number.

Can anyone explain this?

Thanks,
--BobC