How would that interact with all the structures and objects that are created
in my app?

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Behalf Of gregory young
Sent: Wednesday, September 27, 2006 5:25 PM
To: [email protected]
Subject: Re: [ADVANCED-DOTNET] Triggering events at precise moments of
the day


Well depending what you are doing I would prbably just use windows
scheduler.

On 9/27/06, Eddie Lascu <[EMAIL PROTECTED]> wrote:
> Hello experts,
>
> I need to call a method in my console app/win service at precise moments
of
> the day. When I say precise I mean +/- a few seconds. The number of events
> triggered and the time of the day when they should be triggered is
variable.
> If only one method call must be performed, then it should always be
> approximately at the same time of the day, say midnight. If two events are
> to be fired, they should be say 12 hours apart, noon and midnight, and so
> on. The configuration part I can handle. I need some ideas on how to
trigger
> the events.
> I thought about having a dedicated thread where I would have lots of sleep
> periods in an infinite loop. After each sleep period, I could compare the
> current time with the time of the next event that must be fired. The event
> would have to be fired in X seconds and I would enter in a new sleep
period
> for X/2 seconds. Eventually, the difference between the current time and
the
> time of the next event would become smaller that an acceptable delta, at
> which moment I would fire the event and would enter in a new sleep period.
> This way the events would always be fired at approximately the same times
of
> the day, and I wouldn't have to worry about the moment when the
> application/win service was started.
> I am not particularly proud of this solution as it seems kind of empiric,
> but I just couldn't think of anything else.
> Can you gals and guys come up with a more elegant and reliable approach?
>
> TIA,
> Eddie
>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
http://discuss.develop.com
>


--
If knowledge can create problems, it is not through ignorance that we
can solve them.

Isaac Asimov

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to