elapsed time with unsigned tickCount / Wrapping
<p>i have a own GetTickCount() function returning an unsigned int (the count rolls over to zero on 0xFFFFFFFF)</p>

<p>i cant measure an elapsed time with:</p>

<pre><code>unsigned int elapsed;
unsigned int start = GetTickCount();
LongOperation();
unsigned int stop = GetTickCount();

if (stop &gt;= start )
   elapsed = stop - start;
else
   elapsed = (INT_MAX - start) + stop;
</code></pre>

<p>is this the same if i do a cast to signed (the time span i measure is always less than what can be represented in a signed integer - i think about 24 days) ? :</p>

<pre><code>int start = (int)GetTickCount();
LongOperation();
int elapsedTime = (int)GetTickCount() - start;
</code></pre>

<p>if i look at the .net Environmet.TickCount property:</p>

<blockquote>
  <p><em>TickCount will increment from zero to Int32..::.MaxValue for approximately 24.9 days, then jump to Int32..::.MinValue, which is a negative number, then increment back to zero during the next 24.9 days.</em></p>
</blockquote>

<p>so when i cast my GetTickCount() function to a signed integer i should get the behaviour from .net (wrapping occurs on 0x7FFFFFFF->0x80000000) ?</p>

<p>with this should be possible do measure the elapsed time as follow (seen in another post):</p>

<pre><code>int start = Environment.TickCount; 
DoLongRunningOperation(); 
int elapsedTime = Environment.TickCount - start; 
</code></pre>
