Timer accuracy.
#1

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
Reply
#2

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.
Reply
#3

Quote:
Originally Posted by Krx17
View Post
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)