现象:Gettickcount超过49天后会重0开始计时,这样服务器的很多时间间隔逻辑就会错误,为解决该问题,我查询了一些文档,用以下方案即可解决。
var
TSystemTicks = type Int64;
TGetTickCount64 = function:Int64;stdcall;
var
pGetTickCount64:TGetTickCount64;
dllHandle:THandle = 0;
procedure Load_GetTickCount64;
begin
if dllHandle = 0 then
begin
dllhandle = LoadLibrary('kernel32.dll');
pGetTickCount64 := GetProcAddress(dllHandle,'GetTickCount64');
end
end
function GetTickCount64():int64;
begin
result := pGetTickCount64;
end
procedure TForm1.Timer1Timer(Sender:TObject);
begin
memo1.Line.add(inttoStr(GetTickCount64));
momo2.Line.add(inttostr(GetTickCount));
end