troubleshooting Question

C# - Always run an app with the same interval.

Avatar of ocaccy
ocaccyFlag for Japan asked on
Programming.NET ProgrammingC#
7 Comments1 Solution817 ViewsLast Modified:
Hello,

I use timers in my app, but after a while , begins to have delays on timers, these delays will grow over the time.

I throught of some solutions to this problem, and if anyone has other, I would learn.

1st - We always run function at the same time according to the system time.
2nd - Everyday reset the timer.

How to call a function in accordance with the system clock?
How to repeat this function every 2 hours until the funtion is canceled?

Thanks in advance,
ocaccy

"delay captured"
 
2013/6/24 - 7:57:00	first function
2013/6/24 - 8:00:00	second function
2013/6/24 - 8:00:10	third function
2013/6/24 - 8:12:00	fourth function
	
2013/6/24 - 9:57:00	first function
2013/6/24 - 10:00:00	second function
2013/6/24 - 10:00:10	third function
2013/6/24 - 10:12:00	fourth function
	
2013/6/24 - 11:57:01	first function
2013/6/24 - 12:00:01	second function
2013/6/24 - 12:00:11	third function
2013/6/24 - 12:12:01	fourth function
	
2013/6/24 - 13:57:01	first function
2013/6/24 - 14:00:01	second function
2013/6/24 - 14:00:11	third function
2013/6/24 - 14:12:01	fourth function
	
2013/6/24 - 15:57:04	first function
2013/6/24 - 16:00:05	second function
2013/6/24 - 16:00:15	third function
2013/6/24 - 16:12:05	fourth function
	
2013/6/24 - 17:57:04	first function
2013/6/24 - 18:00:04	second function
2013/6/24 - 18:00:14	third function
2013/6/24 - 18:12:04	fourth function
	
2013/6/24 - 19:57:06	first function
2013/6/24 - 20:00:06	second function
2013/6/24 - 20:00:16	third function
2013/6/24 - 20:12:06	fourth function
	
2013/6/24 - 21:57:09	first function
2013/6/24 - 22:00:09	second function
2013/6/24 - 22:00:19	third function
2013/6/24 - 22:12:09	fourth function
	
2013/6/24 - 23:57:11	first function
2013/6/25 - 0:00:11	second function
2013/6/25 - 0:00:21	third function
2013/6/25 - 0:12:11	fourth function
	
2013/6/25 - 1:57:13	first function
2013/6/25 - 2:00:13	second function
2013/6/25 - 2:00:23	third function
2013/6/25 - 2:12:13	fourth function
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros