
-----------------------------------
hq78
Sat Dec 18, 2004 1:38 pm

How to insert a timer (seconds)
-----------------------------------
Hello, I would like to know if anyone here knows how to add a timer in a loop in seconds. Thanks in advance!

-----------------------------------
Cervantes
Sat Dec 18, 2004 1:45 pm


-----------------------------------
There sure is a way to do it :)  Time.Elapsed.

loop
    locate (1, 1)
    put Time.Elapsed / 1000 : 6 : 3, " seconds have passed since this program began."
    if Time.Elapsed / 1000 > 10 then
        locate (2, 1)
        put "That's a long time.  Hop to it!"
    end if
end loop

Note that Time.Elapsed returns a value in milliseconds.  Thus, divide that value by 1000 to get a value in seconds.

-----------------------------------
hq78
Sat Dec 18, 2004 5:14 pm


-----------------------------------
thank you very much!

-----------------------------------
zomg
Sat Dec 18, 2004 11:28 pm


-----------------------------------
doesnt time.elapsed measure cpu time not actual time? :?

-----------------------------------
Neo
Sat Dec 18, 2004 11:48 pm


-----------------------------------
doesnt time.elapsed measure cpu time not actual time? :?

Im pretty sure its the actual length of time since starting the program.

-----------------------------------
Cervantes
Sun Dec 19, 2004 8:25 am


-----------------------------------
doesnt time.elapsed measure cpu time not actual time? :?
ssshh.... :shifty:

-----------------------------------
Mazer
Sun Dec 19, 2004 9:34 am


-----------------------------------
doesnt time.elapsed measure cpu time not actual time? :?
The Time.Elapsed function returns the amount of time since a program (process) started running. The number of milliseconds since the program started running is returned.
Well. Nope. It's just that it's not always accurate.

-----------------------------------
Cervantes
Sun Dec 19, 2004 9:42 am


-----------------------------------
As Delos said, it varies from CPU to CPU.
