Timer Question

Blitz3D Forums/Blitz3D Programming/Timer Question

jimmyx(Posted 2008) [#1]
What code would i use to count in seconds how long my
program has been running for ?

thankyou


Mikel(Posted 2008) [#2]
At the beginning of your program, set a StartTime variable. Just before your program ends set a StopTime variable.

Subtract the two and divide by 1,000 to get seconds.

StartTime = millisecs()
StopTime = millisecs()

DurationSeconds = StopTime - StartTime / 1000


Stevie G(Posted 2008) [#3]
It should be:

DurationSeconds = ( StopTime - StartTime ) / 1000

You don't need the StopTime, just replace with millisecs() again.


GIB3D(Posted 2008) [#4]
This shows how long the program is running, and you can change the offset so you can make it update every second, or minute, or whenever ;)