[fpc-pascal] Will the size of an executable depend on the uses clause
Jean SUZINEAU
jean.suzineau at wanadoo.fr
Wed Jun 16 23:49:32 CEST 2021
My best score is 67 kb after strip -s with the code below ... ;-)
Of course it will not work on every version of Windows.
program uptime;
function GetTickCount64: QWord; stdcall; external 'kernel32.dll';
function _2d( _i: Integer): String;
begin
Str( _i, Result);
if Length(Result) < 2 then Result:= '0'+Result;
end;
function FormatUpTime( _tc: QWord): String;
var
t, d, h, m, s: Integer;
sd: String;
begin
t:= _tc div 1000;
s:= t mod 60;
m:= (t div 60) mod 60;
h:= (t div 3600) mod 24;
d:= (t div 86400);
Result:= _2d(h)+':'+_2d( m)+':'+_2d( s);
if 0 = d then exit;
Str( d, sd);
Result:= sd+' '+Result;
end;
begin
WriteLn( FormatUpTime( GetTickCount64));
end.
More information about the fpc-pascal
mailing list