i have a own GetTickCount() function returning an unsigned int (the count rolls over to zero on 0xFFFFFFFF)
i cant measure an elapsed time with:
unsigned int elapsed;
unsigned int start = GetTickCount();
LongOperation();
unsigned int stop = GetTickCount();
if (stop >= start )
elapsed = stop - start;
else
elapsed = (INT_MAX - start) + stop;
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) ? :
int start = (int)GetTickCount();
LongOperation();
int elapsedTime = (int)GetTickCount() - start;
if i look at the .net Environmet.TickCount property:
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.
so when i cast my GetTickCount() function to a signed integer i should get the behaviour from .net (wrapping occurs on 0x7FFFFFFF->0x80000000) ?
with this should be possible do measure the elapsed time as follow (seen in another post):
int start = Environment.TickCount;
DoLongRunningOperation();
int elapsedTime = Environment.TickCount - start;