Hi.
I need an efficient method of running a piece of code every minute.
I am writing a Windows Service, an I need it to perform a task exactly every minute. It doesnt matter whether it starts counting 1 minute fromn the 'first task', or, 'on the miniute (i.e. 00 seconds).
I am currently using the code in the snippet below, but I dont trust this to be accurate. It MUST fire every minute without fail - do if it fired after 61 seconds, then that would be a problem.
Also I dont like the way way the snippet below it constantly looping forever. (there must be an overhead with that)
Howeber, if this snippet below is "OK" then please say so - and don't try to think up other examples.
Thank you
Start Free Trial