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: 4667
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: 3166
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
0 registered and 301 anonymous users online.
Newest Members
Praveer, Ollero, rayyo, Foxlicht, DonChild
17742 Registered Users

Generated in 0.068 seconds in which 0.047 seconds were spent on a total of 12 queries. Zlib compression enabled.

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