I have my own GetTickCount () function that returns unsigned int (counting the number to zero by 0xFFFFFFFF)
i cannot measure 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 it the same if I am doing a cast to signing (the time interval is always less than what can be represented as an integer - I think about 24 days)?
int start = (int)GetTickCount(); LongOperation(); int elapsedTime = (int)GetTickCount() - start;
if I look at the .net Environmentmet.TickCount property:
TickCount will increase from zero to Int32 .. ::. MaxValue for about 24.9 days, then go to Int32 .. ::. MinValue, which is a negative number, and then increase to zero over the next 24.9 days.
so when I pass the GetTickCount () function to a signed integer, should I get the behavior from .net (the wrapper happens at 0x7FFFFFFF-> 0x80000000)?
with this it should be possible to measure elapsed time as it should (see in another post):
int start = Environment.TickCount; DoLongRunningOperation(); int elapsedTime = Environment.TickCount - start;
source share