Very helpful thanks.
And here's my code (including that tip) which evaluates the whole thing into hours minutes and seconds.
The subroutine
gettimefromsecs can be called from anywhere where you have a variable
elapsedSeconds which contains a number of seconds:
Code: Select all
// gets decimal place character so it will work internationally
LibFunc>kernel32,GetNumberFormatA,r,0,0,str:num,0,buf,255
MidStr>r_5,2,1,DecimalPlaceHolder
// Actual Subroutine
SRT>gettimefromsecs
If>elapsedSeconds<0
Let>elapsedSeconds=elapsedSeconds+86400
endif
let>seconds={round(%elapsedSeconds%)}
IF>seconds>0
let>hours=00
REPEAT>gethours
IF>seconds>3599
let>hours=hours+1
let>seconds=seconds-3600
ENDIF
let>gethours=seconds
StringReplace>gethours,DecimalPlaceHolder,.,gethours
UNTIL>gethours<3600
let>minutes=00
REPEAT>getminutes
IF>seconds>59
let>minutes=minutes+1
let>seconds=seconds-60
ENDIF
let>getminutes=seconds
StringReplace>getminutes,DecimalPlaceHolder,.,getminutes
UNTIL>getminutes<60
ENDIF
END>gettimefromsecs
This will output 3 variables
hours
minutes
seconds
So you can for example:
Code: Select all
msg>%hours%h : %minutes%m : %seconds%s
Will display (example)
10h : 51m : 26s
There may well be much better way to do this. If so feel free to let us know.
:-)