First of all the ticks/millisecs are a 32bit signed value.
Normally (mentioned in the SDK as well) you would do: (pseudocode)
old=ElapsedMilliseconds()
loop and other stuff here
ms=ElapsedMilliseconds()
timepassed=ms-old ;difference thus no wrapping, it IS limited to 47 something days worth of millisecs where it wraps to 0 again so you can't meassure beyond that.
end loop
But if you are only interested in uptime or similar info.
why not simply use Date() ?
Store the start date (32bit signed value in seconds since 1st Jan 1970 and should be ok until um 2038 something?).
you would have to do some simple math to turn those seconds into days, hours minutes and seconds but that is not too difficult.
Here's a procedure I use in GridStream player when displaying how long it's been connected to the stream, and also the uptime of the player.
Code: Select all
Procedure.s CalculateDays(startdate.i,enddate.i)
Protected result$,seconds.i,minutes.i,hours.i,days.i
seconds=enddate-startdate
If seconds<>0
minutes=seconds/60 : seconds-(minutes*60)
hours=minutes/60 : minutes-(hours*60)
days=hours/24 : hours-(days*24)
If days>0
result$=StrU(days,#PB_Long)+" day"
If Not days=1
result$+"s "
Else
result$+" "
EndIf
EndIf
result$+RSet(StrU(hours,#PB_Long),2,"0")+":"
result$+RSet(StrU(minutes,#PB_Long),2,"0")+":"
result$+RSet(StrU(seconds,#PB_Long),2,"0")
EndIf
ProcedureReturn result$
EndProcedure
old=Date()
Delay(1000)
new=Date()
Debug CalculateDays(old,new)
I recommend following my example here for long measurements of time as seconds should be enough precision.
Millisecs are normally only needed in cases where you expect to track only a few days worth of time, usually just a few hours, as any longer than a few hours I always use Date() by habit anyway.