Thanks Thaddy for your answer
Using your function GetTickCount revisited I continue to have Access Violation.
I copy and paste your function GetTickCount revisited in a new console program
program Project1;
uses SysUtils, Unix, baseunix;
function GetTickCount:qword; // it is twice the size of a cardinal!! And unsigned!
var
tv: PTimeVal;
tz: PTimeZone;
begin
tz := nil;
fpgettimeofday(tv, tz); // sure about nil?......?? Also wrong anyway fpgettimeofday returns microsecond resolution NOT nanoseconds. This is also the acces violation...
Result := tv.tv_sec * 1000000 + tv.tv_usec; // is enough. You cast to a signed int64 and return a 32 bit type cardinal.... Won't overflow for a couple of million years
end;
begin
writeln(GetTickCount);
end.
I have some error and warning on compiling
project1.lpr(10,20) Warning: Local variable "tv" does not seem to be initialized
project1.lpr(11,16) Error: Illegal qualifier
project1.lpr(11,16) Hint: may be pointer dereference is missing
project1.lpr(11,15) Error: Incompatible types: got "ptimeval" expected "QWord"
project1.lpr(11,16) Fatal: Syntax error, ";" expected but "identifier TV_SEC" found
googling "free pascal fpgettimeofday" ALL examples / code are passing to the fpgettimeofday function the PTimeZone = nil
Note i'm using lazarus version installed on a Raspberry Pi3
Have you any precious suggestion ?
Thanks