Alexander Dorofeyev <[EMAIL PROTECTED]> writes:
> Yeah these calculations are a headache. I could probably write
>
> now < start_time || now >= start_time + dwTimeout
The right way is to write
now - start_time > dwTimeout
using unsigned variables everywhere. Then you don't have to worry about
Yeah these calculations are a headache. I could probably write
now < start_time || now >= start_time + dwTimeout
to at least avoid a "hang" if GetTickCount counter overflows. This won't solve
not waiting the required time if, say, start_time + dwTimeout overflows, and
that can also be a problem
>-if ((dwTimeout != INFINITE) && (start_time + dwTimeout >= now))
>+if ((dwTimeout != INFINITE) && (now >= start_time + dwTimeout))
>From time immemorial, it has been drummed into me
that one should always handle wraparound when
checking timers. So something like
DWORD delta =