嘻嘻,把这个unit加进去吧。 两种实现方法 clockon - clockoff
clockonnew - clockoffnew,试试啦
unit myDebug;
interface
uses SysUtils,Dialogs,Windows;
procedure ClockOn;
procedure ClockOff;
procedure ClockOnNew;
procedure ClockOffNew;
implementation
var
fResolution,fStart:TLargeInteger;
{ ʹÓ&Atilde
Windows µÄ¸ß¾«¶È¼ÇʱÆ÷ }
fStartEx :Int64
procedure ClockOn;
begin
QueryPerformanceFrequency(fResolution);
QueryPerformanceCounter(fStart);
end;
procedure ClockOff;
var
//fElapsed:TDateTime
fEnd :TLargeInteger;
begin
QueryPerformanceCounter(fEnd);
ShowMessage(format('%.3f 秒,%d 单位',[(fEnd-fStart)/fResolution,fEnd-fStart]));
//fElapsed :=Time - fstart;
//ShowMessage(FormatDateTime('hh:nn:ss',fElapsed ));
end;
procedure ClockOnNew ();
begin
fStartEx := GetTickCount;
end;
procedure ClockOffNew ();
var fA:Int64;
begin
fA:=GetTickCount - fStartEx;
ShowMessage(format('%d',[fA]));
end;