Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   GetTickDiff (https://www.delphipraxis.net/169512-gettickdiff.html)

gargano 25. Jul 2012 13:49

GetTickDiff
 
Hallo

hat jemand den Code für GetTickDiff ?
Er ist normalerweise in IDGlobal, aber wenn ich den dazunehme,
bekomme ich lauter Compilerfehler.

Gruß
Gargano

himitsu 25. Jul 2012 13:54

AW: GetTickDiff
 
Sind bei dir denn keine Indy-Quellcodes vorhanden?

Was für Fehler?

Mathematik? (Differenz zwischen zwei Werten ... das könnte man bestimmt auch selber berechnen :angle2:)


[add]

Delphi-Quellcode:
function GetTickDiff(const AOldTickCount, ANewTickCount: LongWord): LongWord;
{$IFDEF USE_INLINE}inline;{$ENDIF}
begin
  {This is just in case the TickCount rolled back to zero}
  if ANewTickCount >= AOldTickCount then begin
    Result := ANewTickCount - AOldTickCount;
  end else begin
    Result := High(LongWord) - AOldTickCount + ANewTickCount;
  end;
end;
Wobei ich persönlich auch einfach den Überlauf ausnutzen würde. :gruebel:
Delphi-Quellcode:
function GetTickDiff(const AOldTickCount, ANewTickCount: LongWord): LongWord; inline;
begin
  Result := LongWord(ANewTickCount - AOldTickCount); // LongWord(), da ich nicht weiß, ob sich das Inline da richtig verhält
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:02 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz