⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timecount.pas

📁 一个求解TSP问题的例子,用delphi编写.有很好的参考价值
💻 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 + -