Hi,
I know I have seen this somewhere before, but how do you get the time in seconds
that it takes a process to run, eg:
SUB DoSomeStuff
start a timer
run some code
end the timer and get an answer in a variable
ENDSUB
I have done a search, but must be putting in the wrong search terms
Brian
this will do fast timing:
DECLARE IMPORT,GetTickCount(),int
openconsole
int x
int tstart=GetTickCount()
for x=1 to 1000000000
next x
int tstop=GetTickCount()
double elapse=tstop-tstart
setprecision 5
?elapse/1000.0, " seconds"
if you are trying to time stuff that takes minutes then divide by 60000
LarryMc
Hi Brian,
Larry has a good answer, if you want a very simple way you can always do this:
declare three variable at the top of you program and use the built in command 'TIMER'
DEF starttime,endtime,elapsed:int
Then in your sub routine (or and part of your program you want to time), do this:
SUB mybitofcode
starttime = 0
endtime = 0
elapsed = 0
starttime = TIMER
'the code you want goes here
endtime = TIMER
elapsed = endtime - starttime
RETURN
ENDSUB
The variable 'elapsed' will have the number of seconds stored in it.
Hope this helps,
Andy.
Andy,
Larry's code worked, but I like your code - simple is good for me!
Brian