mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 09:09:19 +02:00
* clock_gettime uses timespec, not timeval
git-svn-id: trunk@27446 -
This commit is contained in:
parent
37eb616960
commit
f61e27ec8e
@ -333,9 +333,17 @@ End;
|
|||||||
function GetTickCount64: QWord;
|
function GetTickCount64: QWord;
|
||||||
var
|
var
|
||||||
tp: TTimeVal;
|
tp: TTimeVal;
|
||||||
|
{$IFDEF HAVECLOCKGETTIME}
|
||||||
|
ts: TTimeSpec;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{$IFDEF HAVECLOCKGETTIME}
|
{$IFDEF HAVECLOCKGETTIME}
|
||||||
if clock_gettime(CLOCK_MONOTONIC, @tp)<0 then
|
if clock_gettime(CLOCK_MONOTONIC, @ts)=0 then
|
||||||
|
begin
|
||||||
|
Result := (Int64(ts.tv_sec) * 1000) + (ts.tv_nsec div 1000000);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
fpgettimeofday(@tp, nil);
|
fpgettimeofday(@tp, nil);
|
||||||
Result := (Int64(tp.tv_sec) * 1000) + (tp.tv_usec div 1000);
|
Result := (Int64(tp.tv_sec) * 1000) + (tp.tv_usec div 1000);
|
||||||
|
Loading…
Reference in New Issue
Block a user