I'd like to do some work every 5 seconds. When I say every 5 seconds I mean on 00:00, 00:05, 00:10, 00:15, 00:20 according to the system clock. Not every 5 seconds since the timer is started.
Is there a .net timer which can do this already - I can't find one?
I can think of two work arounds...
Have a very high resolution timer and read the system clock each timer event. Fire off my work immediatelly after each whole 5 secods has passed.
Have a very high resolution timer and read the system clock each timer event. Fire off a second timer which has a resolution of 5 seconds immediatelly after each whole 5 secods has passed.
Not happy with either approach - the first puts unnecessary load on the cpu (depending on how high the reolution is). The second method might drift after a very long time. I don't know whether that's true or not.