Sub Process_Globals
Dim Mins As Int
Dim secs As Long
Dim Rsecs As String
End Sub
Sub Globals
Private lblClockFaceL As Label
Private lblClockFaceP As Label
Dim NowDay As Long
Dim CurrentTime As Long
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
NowDay = DateTime.DateParse(DateTime.Date(DateTime.Now))
CurrentTime = DateTime.Now - NowDay
'
lblClockFaceP.Text = TimeLeft(CurrentTime,0) 'train from Perth to City West - first train leaves on the hour
lblClockFaceL.Text = TimeLeft(CurrentTime,6) 'train from City West to Perth - first train leaves at 6 minutes past the hour
End Sub
Sub TimeLeft(when As Long, FirstTrain As Int) As String
If FirstTrain > 0 Then FirstTrain = FirstTrain * 60000
secs = (15*60*1000-((when-FirstTrain) mod (15*60*1000)))/1000
Mins = secs/60 : Rsecs = "0" & (secs - Mins*60)
Return Mins & ":" & Rsecs.SubString(Rsecs.Length - 2)
End Sub
Sub Activity_Resume