Explorar o código

* Use clock_gettime when available

git-svn-id: trunk@27444 -
michael %!s(int64=11) %!d(string=hai) anos
pai
achega
a92056d219
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  1. 8 1
      rtl/unix/sysutils.pp

+ 8 - 1
rtl/unix/sysutils.pp

@@ -42,7 +42,11 @@ interface
 {$define SYSUTILS_HAS_ANSISTR_ENVVAR_IMPL}
 
 uses
-  Unix,errors,sysconst,Unixtype;
+{$IFDEF LINUX}linux,{$ENDIF} Unix,errors,sysconst,Unixtype;
+
+{$IFDEF LINUX}
+{$DEFINE HAVECLOCKGETTIME}
+{$ENDIF}
 
 { Include platform independent interface part }
 {$i sysutilh.inc}
@@ -330,6 +334,9 @@ function GetTickCount64: QWord;
 var
   tp: TTimeVal;
 begin
+{$IFDEF HAVECLOCKGETTIME}
+  if clock_gettime(CLOCK_MONOTONIC, @tp)<0 then
+{$ENDIF}  
   fpgettimeofday(@tp, nil);
   Result := (Int64(tp.tv_sec) * 1000) + (tp.tv_usec div 1000);
 end;