[fpc-pascal] The unfortunate deprecation of GetTickCount

Luca Olivetti luca at ventoso.org
Wed Apr 11 12:25:16 CEST 2018


El 11/04/18 a les 10:06, Luca Olivetti ha escrit:
> 
> BEFORE (with gettickcount):
> 
> ----------------------------------------------------------------------
> var PreviousTick:DWORD;
> 
> ...
>    PreviousTick:=GetTickCount;
> ...
> ... if DWORD(GetTickCount-PreviousTick)>WaitTime then....


BTW, the DWORD typecast is only necessary with fpc, the following 
program gives 4 and 4 if compiled with delphi 2, 4 and -4294967292 if 
compiled with fpc 3.0.4


program project1;

uses
   windows;

var t1,t2,t3:dword;
begin
   t1:=$fffffffe;
   t2:=2;
   t3:=t2-t1;
   writeln(t3);
   writeln(t2-t1);
end.


-- 
Luca



More information about the fpc-pascal mailing list