Reputation: 55
I created a Timer
private static AutoResetEvent autoEvent;
private static Timer stateTimer;
public static void Start()
{
autoEvent = new AutoResetEvent(false);
TimerCallback timerDelegate = new TimerCallback(SomeClass.TimerLoad);
stateTimer = new Timer(timerDelegate, autoEvent, 1000, 3 * 60 * 60 * 1000);
}
from other procedure I change timer:
stateTimer.Change(0, 5 * 60 * 1000);
now, I need to know what is the interval, is there any appropiate instruction for that ?
Upvotes: 1
Views: 2208
Reputation:
Use System.Timers.Timer instead, that has an interval property.
http://msdn.microsoft.com/en-us/library/system.timers.timer.aspx
Upvotes: 2
Reputation: 48547
Aren't you setting the interval in your Change method call, when you specify 5 * 60 * 1000. So, your interval is 300000.
Upvotes: 0
Reputation: 25563
I have not found a way to do this yet. When faced with the same problem, I resorted to storing the interval whenever I changed my timer.
The "good" way might be to inherit the Timer class and add the property there...
Upvotes: 3