主题:有一个gettime函数
我是严天雯
[专家分:110] 发布于 2006-12-08 17:34:00
有一个gettime函数(大概是这样的)
应该怎么使用
回复列表 (共2个回复)
沙发
zhangyuan [专家分:630] 发布于 2006-12-08 17:35:00
settime(h,m,s,ps);
………………
gettime(h,m,s,ps);
其中h,m,s,ps分别为时,分,秒,百分秒,settime后的参数一般为(0,0,0,0),还有要说明部分加上“uses dos"
板凳
贺天行宝 [专家分:2300] 发布于 2006-12-09 15:06:00
uses dos;{important}
{for date}
procedure knowdate;
var
w1,w2,w3,w4:word;
begin
getdate(w1,w2,w3,w4);
writeln('year:',w1);
writeln('month:',w2);
writeln('date:',w3);
writeln('unknown:',w4);
end;
{for exact time}
procedure gettimeone;{add these at the begin of the program}
var
w1,w2,w3,w4:word;
begin
gettime(w1,w2,w3,w4);
writeln('hour:',w1);
writeln('minute:',w2);
writeln('second:',w3);
writeln('percent second:',w4);
end;
procedure gettimetwo;{add these at the end of the program}
var
w1,w2,w3,w4,w5:word;
begin
gettime(w1,w2,w3,w4);
writeln('hour:',w1);
writeln('minute:',w2);
writeln('second:',w3);
writeln('percent second:',w4);
end;
{example}
begin
knowdate;
gettimeone;
{......
your program
......}
gettimetwo;
{make your program quicker!}
end.
uses sysutils,dos;
var k:longint;
procedure main;
begin
end;
begin
k:=datetimetotimestamp(now).time; {first time}
main;
writeln('Time used:',datetimetotimestamp(now).time-k,'Milliseconds'); {last time}
readln;
end.
{only for fp}
我来回复