📄 timecount.pas
字号:
unit TimeCount;
interface
uses
Windows, SysUtils, Classes;
type
{ TCounter }
TCounter = class(TComponent)
private
FFreq : TLargeInteger;
FStart : TLargeInteger;
function GetElapsedSecs:string;
public
property ElapsedSecs : string read GetElapsedSecs;
procedure StartTimeCount;
end;
implementation
{---------------------------------------------------------------------------------}
procedure TCounter.StartTimeCount;
begin
QueryPerformanceFrequency(FFreq);
QueryPerformanceCounter(FStart);
end;
{---------------------------------------------------------------------------------}
function TCounter.GetElapsedSecs:string;
var
Stop : TLargeInteger;
begin
QueryPerformanceCounter(Stop);
Result := Format('%g', [(Stop - FStart)/ FFreq]);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -