X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/7b8a26e75924ecff47d3e347eb4e2685656c728e..2ba734680253339d8b27208a1dfec5e2f220f3d8:/lcoremessages.pas?ds=inline

diff --git a/lcoremessages.pas b/lcoremessages.pas
index 8a2bd54..b67e4c0 100644
--- a/lcoremessages.pas
+++ b/lcoremessages.pas
@@ -389,7 +389,7 @@ var
   result64: integer;
   tv : ttimeval;
 begin
-  gettimeofday(tv);
+  gettimemonotonic(tv);
   result64 := (tv.tv_sec*1000)+(tv.tv_usec div 1000);
   result := result64;
 end;
@@ -451,7 +451,7 @@ begin
     threaddata := findthreaddata(tm.GetCurrentThreadId);
     if threaddata.lcorethread then raise exception.create('get/peek message cannot be used in the lcore thread');
     message := threaddata.messagequeue;
-    gettimeofday(nowtv);
+    gettimemonotonic(nowtv);
     while (not peek) and (message=nil) and (not tv_compare(nowtv,threaddata.nexttimer)) do begin
       threaddata.waiting := true;
       structurelock.release;
@@ -461,7 +461,7 @@ begin
 
         timeouttv := threaddata.nexttimer;
         timeoutms := (timeouttv.tv_sec * 1000)+(timeouttv.tv_usec div 1000);
-        //i'm assuming the timeout is in milliseconds
+        //i am assuming the timeout is in milliseconds
         if (timeoutms > maxlongint) then timeoutms := maxlongint;
         threaddata.messageevent.waitfor(timeoutms);
 
@@ -469,7 +469,7 @@ begin
       structurelock.acquire;
       threaddata.waiting := false;
       message := threaddata.messagequeue;
-      gettimeofday(nowtv);
+      gettimemonotonic(nowtv);
     end;
     if (message=nil) and tv_compare(nowtv,threaddata.nexttimer) then begin
       processtimers;