Page 1 of 1 1
Topic Options
#144080 - 2005-07-21 10:04 PM Question on ending a loop based on a time constraint
thepip3r Offline
Hey THIS is FUN
*****

Registered: 2005-03-02
Posts: 350
is there a way to kill a loop on the chance that it's running indefinately based off of a time using @ticks???
Top
#144081 - 2005-07-21 10:14 PM Re: Question on ending a loop based on a time constraint
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
You could build in an index variable.

Code:

Do
$index = $index + 1
?$index
Until $index = 10
?"Index is 10, quitting."
sleep 3



@ticks will return a very large number as it returns the elapsed milliseconds since the system has been started.

Quote from the 4.50 manual.
Quote:


@Ticks - Returns the number of milliseconds that have elapsed since the system was started.



_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#144082 - 2005-07-21 10:29 PM Re: Question on ending a loop based on a time constraint
thepip3r Offline
Hey THIS is FUN
*****

Registered: 2005-03-02
Posts: 350
Thanx Mart. So in essence, your loop will only perform 10 iterations... I appreciate the example.
Top
#144083 - 2005-07-22 12:16 AM Re: Question on ending a loop based on a time constraint
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Quote:

is there a way to kill a loop on the chance that it's running indefinately based off of a time using @ticks???




if you really want to exit a loop based on number fo minutes vs number of loops.
need this flipctime()

Code:

$30min = flipctime(@DATE,@TIME) + 1800

While flipctime(@DATE,@TIME) < $30min
;your loop will now run for the next 30 minutes
Loop



Bryce

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.052 seconds in which 0.022 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org