Skip to content

Commit

Permalink
Removed unneeded (after castle-engine#132) time measurement test on A…
Browse files Browse the repository at this point in the history
…ndroid.
  • Loading branch information
and3md committed Sep 3, 2019
1 parent 61857e2 commit 5a92eeb
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions src/base/castletimeutils.pas
Expand Up @@ -589,14 +589,6 @@ function Timer: TTimerResult;
TimerFrequency: TTimerFrequency = 1000000;

{$ifdef ANDROID}
var
{ Note that using this makes Timer not thread-safe
(but we neved guaranteed in the interface that it's thread-safe...).
This variables can be removed once everyone confirms that the
solution of using CLOCK_MONOTONIC is always working. }
LastTimer: TTimerResult;
LastTimerLog: TTimerResult;

function Timer: TTimerResult;
var
tp: TimeSpec;
Expand All @@ -610,21 +602,6 @@ function Timer: TTimerResult;

clock_gettime(CLOCK_MONOTONIC, @tp);
Result.Value := QWord(tp.tv_sec) * 1000000 + QWord(tp.tv_nsec div 1000);

{ I leave this test to check the solution of using CLOCK_MONOTONIC, but it
really isn't needed anymore. }
if Result.Value < LastTimer.Value then
begin
{ Limit logs to not affect performance (one detection can make about
300 lines of log) }
if LastTimerLog.Value <> LastTimer.Value then
begin
WritelnLog('Time', 'Detected gettimeofday() going backwards on Unix, workarounding. This is known to happen on some Android devices');
LastTimerLog.Value := LastTimer.Value;
end;
Result.Value := LastTimer.Value;
end else
LastTimer.Value := Result.Value;
end;

{$else}
Expand Down

0 comments on commit 5a92eeb

Please sign in to comment.