RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Timer Delay Above 1 Minute?

Peoharen

Sorceror
Timer Delay Above 1 Minute?

Then you should change it's priority.

TimerPriority is always set to be shorter than the Interval (your Tick rate) to maintain a level of accuracy. Example, a once per minute tick rate would mean the timer is checked every five seconds so there is never more than a 5 second delay in the timer's accuracy. A timer that ticks every second however is checked 40 times in between each tick. The accuracy costs more in CPU than the timer it's self does in most cases.

RunUO's longest delay using ComputePriority is five seconds. Your one tick per hour timer is checked 720 times to see if it can tick before it does. However, you can squeeze a bit of optimization out of the timer it's self. Add this to your timer's constructor TimerThread.PriorityChange( this, 7 );

Now your timer runs on the 1 minute thread, in other words it is checked 60 times per hour. About twelve times less than what you are using now. Not too shabby for a single line of code eh?
 
Top