各位哥哥好,我是一只菜鸟,这个函数看不太懂,能不能帮我加上个注释
function tForm1.cal_length(long:integer):string; //定义函数
var
s:string;
hours,minutes,seconds:integer;
begin
long:=long div 1000;
seconds:= long mod 60;
long:=long div 60;
minutes:=long mod 60;
hours:=long div 60;
if strlen(pchar(inttostr(hours)))=1 then
s:='0'+inttostr(hours)
else
s:=inttostr(hours);
s:=s+':';
if strlen(pchar(inttostr(minutes)))=1 then
s:=s+'0'+inttostr(minutes)
else
s:=s+inttostr(minutes);
s:=s+':';
if strlen(pchar(inttostr(seconds)))=1 then
s:=s+'0'+inttostr(seconds)
else
s:=s+inttostr(seconds);
cal_length:=s;
end;
function tForm1.cal_length(long:integer):string; //定义函数
var
s:string;
hours,minutes,seconds:integer;
begin
long:=long div 1000;
seconds:= long mod 60;
long:=long div 60;
minutes:=long mod 60;
hours:=long div 60;
if strlen(pchar(inttostr(hours)))=1 then
s:='0'+inttostr(hours)
else
s:=inttostr(hours);
s:=s+':';
if strlen(pchar(inttostr(minutes)))=1 then
s:=s+'0'+inttostr(minutes)
else
s:=s+inttostr(minutes);
s:=s+':';
if strlen(pchar(inttostr(seconds)))=1 then
s:=s+'0'+inttostr(seconds)
else
s:=s+inttostr(seconds);
cal_length:=s;
end;
begin
long := long div 1000;
Result := Format('%0.2d:%0.2d:%0.2d', [long div 3600, long div 60 mod 60, long mod 60]);
end;