|
|
@@ -25,6 +25,8 @@ uses |
|
|
|
function GetTickCount64: QWord; |
|
|
|
function GetMicroTime: QWord; |
|
|
|
|
|
|
|
function utlRateLimited(const Reference: QWord; const Interval: QWord): boolean; |
|
|
|
|
|
|
|
implementation |
|
|
|
|
|
|
|
{$IF defined(WINDOWS)} |
|
|
@@ -45,11 +47,6 @@ begin |
|
|
|
QueryPerformanceCounter(pc); |
|
|
|
Result:= (pc * 1000*1000) div PERF_FREQ; |
|
|
|
end; |
|
|
|
|
|
|
|
initialization |
|
|
|
PERF_FREQ := 0; |
|
|
|
QueryPerformanceFrequency(PERF_FREQ); |
|
|
|
|
|
|
|
{$ELSEIF defined(UNIX)} |
|
|
|
function GetTickCount64: QWord; |
|
|
|
var |
|
|
@@ -66,7 +63,6 @@ begin |
|
|
|
fpgettimeofday(@tp, nil); |
|
|
|
Result := (Int64(tp.tv_sec) * 1000*1000) + tp.tv_usec; |
|
|
|
end; |
|
|
|
|
|
|
|
{$ELSE} |
|
|
|
function GetTickCount64: QWord; |
|
|
|
begin |
|
|
@@ -80,5 +76,15 @@ end; |
|
|
|
|
|
|
|
{$ENDIF} |
|
|
|
|
|
|
|
function utlRateLimited(const Reference: QWord; const Interval: QWord): boolean; |
|
|
|
begin |
|
|
|
Result:= GetMicroTime - Reference > Interval; |
|
|
|
end; |
|
|
|
|
|
|
|
initialization |
|
|
|
{$IF defined(WINDOWS)} |
|
|
|
PERF_FREQ := 0; |
|
|
|
QueryPerformanceFrequency(PERF_FREQ); |
|
|
|
{$ENDIF} |
|
|
|
end. |
|
|
|
|