Auf den ersten Blick ist es auch nicht notwendig Threading zu fixen, da Emba das schon berücksichtigt.
Delphi-Quellcode:
class function TThread.GetTickCount: Cardinal;
{$IF Defined(MSWINDOWS)}
begin
Result :=
Winapi.Windows.GetTickCount;
end;
{$ELSE}
begin
Result := Cardinal(GetTickCount64);
end;
{$ENDIF}
class function TThread.GetTickCount64: UInt64;
{$IF Defined(MSWINDOWS)}
begin
if TOSVersion.Major >= 6
then Result :=
Winapi.Windows.GetTickCount64
else Result :=
Winapi.Windows.GetTickCount;
end;
{$ELSEIF Defined(MACOS)}
begin
Result := AbsoluteToNanoseconds(mach_absolute_time)
div 1000000;
end;
{$ELSEIF Defined(POSIX)}
var
res: timespec;
begin
clock_gettime(CLOCK_MONOTONIC, @res);
Result := UInt64(1000 * res.tv_sec + res.tv_nsec
div 1000000);
end;
{$ELSE OTHERPLATFORM}
{$MESSAGE Fatal 'Method not implemented for Platform'}
{$ENDIF OTHERPLATFORM}