Consider the conditional timer inputbabazaroni wrote:I'm ok with either taking the time, or capturing it in the case statement, but I'm still wondering about this overflow situation.
Lets assume the case statement fires and 4294E6 is captured in 'time'. Now 1E6 gets added to 'time', but 4295E6 overflows to 32704 in a 32 bit word.
Now, until the actual timer value overflows, the case statement will continue to fire immediately on entry, instead of waiting 1E6 ticks, which is undesired.
I don't want to write a bunch of code which detects the overflow and makes adjustments, if there is a better way to handle this situation.
Code: Select all
t when timerafter(time).
Code: Select all
currentTime > time
Code: Select all
(signed int)time - (signed int)currentTime < 0
If you wanted to wait for longer than 21 seconds you would need to worry about overflow. For example if you wanted to wait for 30 seconds you would need to first wait for 21 seconds to pass using a conditional timer input and then wait for a further 9 seconds to pass with a second conditional timer input.