Is it possible to use a TFPTimer in the console of my Raspberry ZERO lazarus / 32-Linux ---------------------------------------------------------------------- pascalbythree · 2023-04-08 11:10 Is it possible to use a TFPTimer in the console of my Raspberry ZERO with FPC 3.2.2 ? Or is it not supported ? It does not seem to run and i did see a access violation or two. Anybody Example code ? Greets, Wouter Of course it is working on a form, but now in the console. Now i am doing this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TAppProgBench.FTimerTimer(Sender: TObject);begin  // log('Timer1Exec',yellow);  end;  Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   //******* ********************************************************************** *********   FTimer := TFPTimer.Create(nil); FTimer.OnTimer := @FTimerTimer; FTimer.Interval := 1000; // in milliseconds FTimer.Enabled := True;         FTimer.StartTimer;  //*** ********************************************************************** ************* Anybody knows what to change ? Grtz W ---------------------------------------------------------------------- balazsszekely · 2023-04-08 11:56 @pascalbythree Console applications don't have a message loop so TFPTimer won't work. Just start a worker thread and measure time with GetTickCount64. See attached project for more details. Let me know if it works on Raspberry. ---------------------------------------------------------------------- pascalbythree · 2023-04-08 13:32 YaY Yay YAy!  It got to work, again, thank you very much !  PS: Also on raspberry ---------------------------------------------------------------------- TRon · 2023-10-02 08:13 Small update for this thread (as it just happened that I stumbled upon it in search for something else). GetMem's example works like a charm, however: TFPTimer does work when you enable UseTimerThread which (pretty much unsurprisingly) creates a thread for you in the background without the need to do that manually. Ofc. it does require threads so if your platform requires it then do not forget to add your platform specific threads unit as first entry to your uses clause (don't worry though as the runtime library will explain that to you as well in case you forgot  ).