Recommended Posts


Is there any timer or ready function which i can use for cronometer?

I wrote following sequence:

global sec
global minut
global hour

sec =0
minut = 0
hour = 0


   if (sec>60)
   sec= 0
   minut= minut+1

   minut= 0
   hour= hour+1



but here, on the screen it shows 0:0:0 in the beginning.

Can I make it 00: 00: 00 format? Or should I write sequence for other zeros?

thank you,


Link to comment
Share on other sites

Just use systime() to get the starttime and record it in a variable. Then you can just use systime() again at any instant and substract the starttime variable from it to get the elapsed time. Use the formatdateTime() function on the result using %H%M%S as the specifier.

Link to comment
Share on other sites

when I use systime(), its hard to substract.

for example, when I start cronometer 11:58:52

so my recorded hour- 11, minutes- 58, seconds- 52

strtodouble(formatdatetime("%S", systime()))-seconds[0]

after 8 seconds, it goes to - 51, -50, -49.......

Link to comment
Share on other sites

Is seconds[0] the start time? If so, it needs to be inside the formatdatetime. Also you don't need strtodouble. That will convert the string back to a number.

You want something like this:

whenever you want to reset the time:

global starttime = systime()

to display the timer in HMS:

formatDateTime("%H%M%S", systime() - starttime)

to just get the elapsed time in seconds:

systime() - starttime

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.