you are right but...
it seems that @ticks returns a signed 32bits counter.
it means that the value :
- is incremented from 0 to 2147483647 (24d 20h 31m 23s and 647ms)
- then becomes -2147483648
- then is incremented from -2147483648 to 2147483647 (49d 17h 2m 47s and 295ms)
and so on. It would be unlucky to measure script execution when @ticks reaches the max value but it is possible. If i have a code like the following
 Code:
$starttime=@ticks
...
$endtime=@Ticks
$elapsedtime=$endtime-$starttime
the result is wrong only if $starttime > $endtime. In this case, we should use (2147483647-$startime)+(2147483648+$endtime)+1.
As i have a problem with minimal negative value in kix, i have the following code :
 Code:
$starttime=@ticks
...
"elapsed time : " elapsedtime( $startime, @ticks ) ?

function elapsedtime( $t1, $t2 )
	if ($t2<$t1)
		$c1 = CDBL(2147483647.0)-$t1			; from $t1 to 2147483647
		$c2 = CDBL(1.0) * $t2 + 2147483647 + 1		; from -2147483648 to $t2
		$elapsedtime = INT($c1 + $c2 + 1)
	else
		$elapsedtime = $t2 - $t1
	endif
endfunction


An other reason to use @TICKS in calculation instead of @Date, @Time, @MSecs is that in background, w32time service can change the windows clock !!!
I use @Date and @Time to write in log file but it is just an indication. I don't use theses macros to calculate elapsed time.



Edited by ChristopheM (2014-01-21 10:46 PM)
_________________________
Christophe