Newbie Timer Question

  • Thread starter One Handed Man [ OHM# ]
  • Start date
O

One Handed Man [ OHM# ]

I want a timer event to fire at particular times in the hour. The problem is depending on the day on which the program is running, I want to determine the frequency of interval. However, this is further complicated by the fact that dont want the timer to tick during minutes 7,19,22,44,47,21. During those minutes, I want to instantiate a LotteryClass to generate next weeks winning numbers based on this weeks winning numbers before the lottery is drawn.

On Mondays I want the interval to be 5 minutes because I am having my hair cut, and wednesday I go to the gym, so I want the interval to be 10 minutes all the other days, the interval can be the squaure root of my age (6).

Can anyone help ?

Regards - OHM#


(e-mail address removed)
 
O

One Handed Man [ OHM# ]

Yes, thats right Cor
Regards - OHM#


(e-mail address removed)
HI OHM,

Do they use in the UK arlready minutes like the rest of Europe?

Cor
 
C

Cor

PSEUDO - Hope this helps - Regards Cor

Dim FirstTick As Boolean = True
Dim TimeNow as New DateTime = Now
Dim MinuteNow As Int32 = TimeNow.GetMinute
Dim InterimInterval As Int32

While MinuteNow < 15
MinuteNow = TimeNow.GetMinute
Loop

InterimInterval = 10 - ( MinuteNow MOD 10 )

Set Timer = InterimInterval

Sub On TimerTick

If FirstTick The
Set Timer Interval = 10
FirstTick = False
End If

End Sub
 
S

Sueffel

Boy you are making this complicatied! LOL. Here's what I'm seeing, make a class that has a thread in it, in the thread, do a thread.sleep(1000) and every second fire off a intervalTick event in the class. In the event, pass to it current time. You can make this interval 60000 (60 seconds) if you want, and fire it every minute. Then have a config or XML file sitting off somewhere that has the times and dates and what actions, and check that every minute and perform the action. Or, to take it a step further, read the XML file into a Structure that is you "database" of events and when they happen. Sounds like you just need a schedular program.
If I'm off-base and rambling, just tell me to shut-up! Naw, just kidding, but hey, I'll throw in my 2 cents and maybe it might spark something useful,

Sueffel
I want a timer event to fire at particular times in the hour. The problem is depending on the day on which the program is running, I want to determine the frequency of interval. However, this is further complicated by the fact that dont want the timer to tick during minutes 7,19,22,44,47,21. During those minutes, I want to instantiate a LotteryClass to generate next weeks winning numbers based on this weeks winning numbers before the lottery is drawn.

On Mondays I want the interval to be 5 minutes because I am having my hair cut, and wednesday I go to the gym, so I want the interval to be 10 minutes all the other days, the interval can be the squaure root of my age (6).

Can anyone help ?

Regards - OHM#


(e-mail address removed)
 
O

One Handed Man [ OHM# ]

No No No No No, this will cause an endless loop, I really dont think my haridresser will be very pleased if she has to wait forever for me to get to my weekly appointment.

Cant you come up with anything better than this ?
Regards - OHM#


(e-mail address removed)
PSEUDO - Hope this helps - Regards Cor

Dim FirstTick As Boolean = True
Dim TimeNow as New DateTime = Now
Dim MinuteNow As Int32 = TimeNow.GetMinute
Dim InterimInterval As Int32

While MinuteNow < 15
MinuteNow = TimeNow.GetMinute
Loop

InterimInterval = 10 - ( MinuteNow MOD 10 )

Set Timer = InterimInterval

Sub On TimerTick

If FirstTick The
Set Timer Interval = 10
FirstTick = False
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top