SRL Archive - SRL Archives

KWorkedFor


XxKanexX

2006-06-23 08:06:55

Goes from Milli Seconds to Days. I wrote it for a private script and thought that it might be a good use for SRL. ;D


procedure KWorkedFor(Start: Integer);
var t, Bs: String;
var i, a, b, c, d, g: Integer;
begin
g:= (GetSystemTime-Start)/1000;
i:= g * 1000 mod 60;
a:= g mod 60;
b:= g/60 mod 60;
c:= g/60/60 mod 24;
d:= g/60/60/24 mod 7;
if (i = 1) then Bs:= 'Milli Second' else Bs:= 'Milli Seconds';
t:= Inttostr(i) + ' ' + Bs + '. ';
if (a > 0) then
begin
if (a = 1) then Bs:= 'Second' else Bs:= 'Seconds';
t:= Inttostr(a) + ' ' + Bs + '. ' + t;
end;
if (b > 0) then
begin
if (b = 1) then Bs:= 'Minute' else Bs:= 'Minutes';
t:= Inttostr(b) + ' ' + Bs + ', ' + t;
end;
if (c > 0) then
begin
if (c = 1) then Bs:= 'Hour' else bs:= 'Hours';
t:= Inttostr(c) + ' ' + Bs + ', ' + t;
end;
if (d > 0) then
begin
if (d = 1) then Bs:= 'Day' else bs:= 'Days';
t:= Inttostr(d) + ' ' + Bs + ', ' + t;
end;
Writeln('Worked For: ' + t);
end;

Wizzup?

2006-06-23 10:34:26

Nice. :D

XxKanexX

2006-06-24 07:42:49

Thankyou :p..