|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
System clock eventsHi,
Is there anyway to be notified with the system clock changes? I don't mean when the user changes the settings, but each time (in my case) it swicthes minute? I have some code I would like to run each time the minute changes of the system clock. I could use a Timer object and set it's intervall to a minute, but then it would only execute within a given minute of the system clock, I want a trigger when it changes. I dont mind using interop if thats what is required "Andreas Håkansson" <andreas.hakans***@sembo.se> wrote: The system clock changes continuously many times per second. There> Is there anyway to be notified with the system clock changes? aren't separate events for per-minute changes. > I don't mean Your best bet is to look at the current time, and set the interval to> when the user changes the settings, but each time (in my case) it swicthes > minute? I have some code I would like to run each time the minute changes of > the system clock. I could use a Timer object and set it's intervall to a > minute, but then it would only execute within a given minute of the system > clock, I want a trigger when it changes. last you until just after the minute has changed. Every subsequent time the event is triggered, repeat: recalibrate the interval based on the current time so that the next event is due to happen just after the minute has changed. -- Barry On Mon, 15 May 2006 16:46:21 +0200, "Andreas Håkansson"
<andreas.hakans***@sembo.se> wrote: >Hi, Set a Timer object to once/second, then test the second value to see> >Is there anyway to be notified with the system clock changes? I don't mean >when the user changes the settings, but each time (in my case) it swicthes >minute? I have some code I would like to run each time the minute changes of >the system clock. I could use a Timer object and set it's intervall to a >minute, but then it would only execute within a given minute of the system >clock, I want a trigger when it changes. > >I dont mind using interop if thats what is required > if it is zero, or else test the minute value to see if it has changed. Running the timer event processor 59 times when it is not needed seems like a waste but is a completely negligible use of system time. It works well and is simple. Of course if you need to know the even to better than one second accuracy, you will have to check more frequently. |
|||||||||||||||||||||||