Here is the code I am using:
ticks=Now-timerticks
maintime = maintime + (ticks/1000000)
intervaltime = intervaltime + (ticks/1000000)
timerticks=Now
displayTimers
Sub displayTimers
maintimehour=Int(maintime/36000)
maintimemin=Int((maintime-(maintimehour)*36000)/600)
maintimesec=Int((maintime-(maintimehour)*36000-(maintimemin)*600)/10)
maintimetenth=maintime-(maintimehour)*36000-(maintimemin)*600-(maintimesec)*10
TotalTime.Text = maintimehour & ":" & Format(maintimemin,"D2") & ":" & Format(maintimesec,"D2") & "." & Int(maintimetenth)
inttimehour=Int(intervaltime/36000)
inttimemin=Int((intervaltime-(inttimehour)*36000)/600)
inttimesec=Int((intervaltime-(inttimehour)*36000-(inttimemin)*600)/10)
inttimetenth=intervaltime-(inttimehour)*36000-(inttimemin)*600-(inttimesec)*10
IntervalTime.Text = inttimehour & ":" & Format(inttimemin,"D2") & ":" & Format(inttimesec,"D2") & "." & Int(inttimetenth)
End Sub
When testing with the development tool, I am getting the tenth of seconds counting up on the timers. But when I build and use it on the phone, the tenths of seconds stays at 0 (the timer otherwise counts up at a second's pace though).
Any ideas? Thanks.
(On another note, I don't think this is the best way (in that I think there are some time inaccuracies introduced over a long period of time) to accomplish what I wanted here anyway, but it works for now. Any thoughts on the best way of increasing a timer, while allowing start/pause functionality, would be helpful).
ticks=Now-timerticks
maintime = maintime + (ticks/1000000)
intervaltime = intervaltime + (ticks/1000000)
timerticks=Now
displayTimers
Sub displayTimers
maintimehour=Int(maintime/36000)
maintimemin=Int((maintime-(maintimehour)*36000)/600)
maintimesec=Int((maintime-(maintimehour)*36000-(maintimemin)*600)/10)
maintimetenth=maintime-(maintimehour)*36000-(maintimemin)*600-(maintimesec)*10
TotalTime.Text = maintimehour & ":" & Format(maintimemin,"D2") & ":" & Format(maintimesec,"D2") & "." & Int(maintimetenth)
inttimehour=Int(intervaltime/36000)
inttimemin=Int((intervaltime-(inttimehour)*36000)/600)
inttimesec=Int((intervaltime-(inttimehour)*36000-(inttimemin)*600)/10)
inttimetenth=intervaltime-(inttimehour)*36000-(inttimemin)*600-(inttimesec)*10
IntervalTime.Text = inttimehour & ":" & Format(inttimemin,"D2") & ":" & Format(inttimesec,"D2") & "." & Int(inttimetenth)
End Sub
When testing with the development tool, I am getting the tenth of seconds counting up on the timers. But when I build and use it on the phone, the tenths of seconds stays at 0 (the timer otherwise counts up at a second's pace though).
Any ideas? Thanks.
(On another note, I don't think this is the best way (in that I think there are some time inaccuracies introduced over a long period of time) to accomplish what I wanted here anyway, but it works for now. Any thoughts on the best way of increasing a timer, while allowing start/pause functionality, would be helpful).