Having asked so much and returned so few I thought I'd share a piece of code that I currently use in a timer application that I'm making. It is a function that transforms a given number of miliseconds into an array with three values (hours, minutes, seconds). I couldn't find it in the forums, but if it is already there, please delete this thread

Code: Select all
Procedure MsToTimeDisplay(ms.l, mode.l)
If ms.l > 3600000
hrs.l = Round((ms.l/3600000),0)
ms.l = ms.l - (3600000*hrs.l)
EndIf
If ms.l > 60000
mins.l = Round((ms.l/60000),0)
ms.l = ms.l - (60000*mins.l)
EndIf
If ms.l > 1000
sec.l = Round((ms.l/1000),0)
ms.l = ms.l - (1000*sec.l)
EndIf
Dim time_s.s(3)
Dim time_l.l(3)
If hrs.l < 10
time_s(0) = "0"+Str(hrs.l)
Else
time_s(0) = Str(hrs.l)
EndIf
time_l(0) = hrs.l
If mins.l < 10
time_s(1) = "0"+Str(mins.l)
Else
time_s(1) = Str(mins.l)
EndIf
time_l(1) = mins.l
If sec.l < 10
time_s(2) = "0"+Str(sec.l)
Else
time_s(2) = Str(sec.l)
EndIf
time_l(2) = sec.l
If mode.l = 1
ProcedureReturn time_s()
Else
ProcedureReturn time_l()
EndIf
EndProcedure
Code: Select all
; Change the array declaration (add one more field to both)
Dim time_s.s(4)
Dim time_l.l(4)
; Add the following lines
time_s(3) = Str(ms.l)
time_l(3) = ms.l
Code: Select all
If ms.l > 86400000
days.l = Round((ms.l/86400000),0)
ms.l = ms.l - (86400000*days.l)
EndIf