Sub FindNextTimeInDay(Hours As Int, Minutes As Int) As Long
Dim ticks As Long
Dim now As Long = DateTime.Now
ticks = DateUtils.SetDateAndTime(DateTime.GetYear(now), DateTime.GetMonth(now), _
DateTime.GetDayOfMonth(now),Hours, Minutes, 0)
If ticks < now Then
'skip to tomorrow
Dim p As Period
p.Days = 1
ticks = DateUtils.AddPeriod(ticks, p)
End If
Return ticks
End Sub