TTimer < 100 inaccurate lazarus / 8-Other ---------------------------------------------------------------------- Marmin_ · 2006-04-29 04:36 TTimer object is horrible inaccurate if interval is set < 100 (on my windows machine). I tested with another timer2, set on 1000, and used a integer counter. results: timer1     _______________ 1000               FPS = 1 500           FPS = 2 250 FPS = 4 100 FPS = between 9 and 10 50  FPS = 16 should be 20 25  FPS = 32 should be 40 20 it sticks on 32 ?? should be 50 < 20 keeps sticking on 32 15 FPS = 64 ? that is again ~ correct should be 66.   :evil:  ? ---------------------------------------------------------------------- Marc · 2006-05-01 09:42 Ttimer & co are inaccurate by design. First since the windows timer has a limited resolution, second, the timer depends on windows messages en thus the time they are dispatched. ---------------------------------------------------------------------- felipemdc · 2006-05-01 20:33 This is known, if you want precision you should use EpikTimer. Here is it's webpage: http://wiki.lazarus.freepascal.org/index.php/EpikTimer EpikTimer is precise enougth to run a digital Oscilloscope getting data at 200Khz from a ISA board on a graphical environment on a old computer (400Mhz). If you want to see the code of a full digital oscilloscope using it and it's documentation you can find it here: http://eletronicalivre.incubadora.fapesp.br/portal/english/oscilloscop e/ ---------------------------------------------------------------------- Marmin_ · 2006-05-04 16:10 EpikTimer works  well, thanks for the tip. However, there seems to be no OnTimer event unfortunately, so I created Threads to have it work. It works very good, Timing is more smooth than standard TTimer. ---------------------------------------------------------------------- Anonymous · 2006-05-05 06:07 Be aware EpikTimer uses RDTSC, ie. it will not work on CPUs with varying clock frequency: pretty much all mobile CPUs, Athlon 64 and Semprons with Cool'n Quiet enabled, etc. ---------------------------------------------------------------------- felipemdc · 2006-05-05 17:54 Quote from: "Anonymous"Be aware EpikTimer uses RDTSC, ie. it will not work on CPUs with varying clock frequency: pretty much all mobile CPUs, Athlon 64 and Semprons with Cool'n Quiet enabled, etc. I don´t agree. EpikTimer does not depend on a single model to retrive time. It will use Hardware Clock if it is available. If the CPU cannot support RDTSC it will detect it and retrive the time from the Operating system (called Software Mode). The software mode is different on each operating system. You can also set the software mode manually if you feel it is better for this kinds of hardware. Then it can only be wrong if the operating system is also wrong. EpikTimer worked on all CPUs I tested and I did some extensive tests. If you tested it and it doesn´t work on a particular CPU please tell me. ---------------------------------------------------------------------- Marmin? · 2006-05-05 20:04 Hm.. I use the EpikTimer on my Mobile AMD64 3200 + processor. (On a laptop with XP). No runtime errors.  I'll see if I encounter errors, if I set it on Hardware time base. I've set it now on systemtimeBase. Quote from: "Anonymous"Be aware EpikTimer uses RDTSC, ie. it will not work on CPUs with varying clock frequency: pretty much all mobile CPUs, Athlon 64 and Semprons with Cool'n Quiet enabled, etc. ---------------------------------------------------------------------- marmin · 2006-05-05 20:10 I set it on HardwareTimeBase, no errors yet.