Timer accuracy. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP (
https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (
https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: Timer accuracy. (
/showthread.php?tid=253740)
Timer accuracy. -
Danny - 07.05.2011
Hi,
I heard this from a friend of mine, then i've tested it by myself.
The SA:MP timers are not very accurate, they are not at ALL.
A second (1000 ms) with SetTimer or SetTimerEx last something like 1,1 second
(dont know exactly, just an example) Does that really matter, you maybe think? Yes,
Im using a timer for a weedsystem that will activate a system 10 minutes after the player planted the weed.
I tested it, and the timer takes 11 minutes to execute the code. A whole extra minute!
I'm curious, does anyone have noticed this too? Can the SA:MP team fix this?
Greetz.
Danny
Re: Timer accuracy. -
Krx17 - 07.05.2011
It could be that your code takes 100ms to execute after the timer hits. It could also be that, afaik, the scripts are run as a single thread, which means one thing has to finish before another thing may begin. Example: You have two systems, a drug system and a job system. If the drug system is on a timer and it is set to be executed in 1000ms. It could be executed at 1100ms if the job system needs to do some work right before it.
Re: Timer accuracy. -
Ash. - 07.05.2011
Quote:
Originally Posted by Krx17
It could be that your code takes 100ms to execute after the timer hits. It could also be that, afaik, the scripts are run as a single thread, which means one thing has to finish before another thing may begin. Example: You have two systems, a drug system and a job system. If the drug system is on a timer and it is set to be executed in 1000ms. It could be executed at 1100ms if the job system needs to do some work right before it.
|
Yes, which is why in response to -Danny- it is best to benchmark your code, and make optimization where necessary. Y_Less posted some really informative stuff on how PAWN language is read. I can't find it any more though.