Sub Process_Globals
Private timer1 As Timer
Private targetTime As Long
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
timer1.Initialize("timer1", 1000)
End If
StartTimer(2, 30)
End Sub
Sub StartTimer (Hours As Int, Minutes As Int)
targetTime = DateTime.Now + Hours * DateTime.TicksPerHour + Minutes * DateTime.TicksPerMinute
timer1.Enabled = True
End Sub
Sub Timer1_Tick
Dim t As Long = Max(0, targetTime - DateTime.Now)
Dim hours, minutes, seconds As Int
hours = t / DateTime.TicksPerHour
minutes = (t Mod DateTime.TicksPerHour) / DateTime.TicksPerMinute
seconds = (t Mod DateTime.TicksPerMinute) / DateTime.TicksPerSecond
Log($"$2.0{hours}:$2.0{minutes}:$2.0{seconds}"$)
If t = 0 Then
timer1.Enabled = False
End If
End Sub