The code works fine in all cases. This converts the seconds to hours, mintues, and seconds, so the output will look something like: 2h 0m 34s.
>Your code fails if the number of hours or minutes is zero.
>
>Vlad
>
>>Well, I hate sloppy code, so here is the new code using the SECONDS() function. It is considerably smaller:
>>
>>****************************************************************************
>>Procedure R_TimeElapsed &&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
>>****************************************************************************
>>PARAMETERS pTimeStart,pTimeEnd
>>
>>PRIVATE xElapsed,xSec,xMin,xHour,xReturn
>>
>>if pTimeStart > pTimeEnd
>> xElapsed = (24*60*60)-pTimeStart+pTimeEnd
>>else
>> xElapsed = pTimeEnd - pTimeStart
>>endif
>>
>>if xElapsed >= 3600
>> xHours = Int(xElapsed/3600)
>> xElpased = xElapsed - (3600*xHours)
>>endif
>>if xElapsed >= 60
>> xMin = Int(xTime/60)
>> xElapsed = xElapsed - (60*xMin)
>>endif
>>xSec = xElapsed
>>xReturn = ALLTRIM(STR(xHour))+"h "+ALLTRIM(STR(xMin))+"m ";
>> +ALLTRIM(STR(xSec))+"s"
>>
>>Return xReturn