Sir R. M8gic1an
2009-04-22 09:15:59
Function msToTime(ms: integer): string;
var
RHours, Minutes, Seconds, RMinutes, RSeconds: LongInt;
Time: string;
begin
Seconds := ms div 1000;
Minutes := Seconds div 60;
RHours := Minutes div 60;
Time := IntToStr(Seconds) + ' Seconds';
if Minutes <> 0 then
begin
RSeconds := Seconds mod (Minutes * 60);
Time := IntToStr(Minutes) + ' Minutes and ' + IntToStr(RSeconds) +
' Seconds';
end;
if RHours <> 0 then
begin
RMinutes := Minutes mod (RHours * 60);
RSeconds := Seconds mod (Minutes * 60);
Time := IntToStr(RHours) + ' Hours, ' + IntToStr(RMinutes) +
' Minutes and ' + IntToStr(RSeconds) + ' Seconds';
end;
Result := Time;
end;
{*******************************************************************************
function TimeRunning: String;
By: from Phalanx's script/RsN
Description: Returns Time since ST (Script StartTime).
*******************************************************************************}
function TimeRunning: String;
begin
Result := msToTime(GetTimeRunning);
end;
I don't feel comfortable taking credit for one line :/ or worse, one variable >.>
anyway, just thought it might be better broken down like this, allows people to use it for more things.
~RM