By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,353 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,353 IT Pros & Developers. It's quick & easy.

date/time elapsed event

P: n/a
Hi,

I'm looking for a better way to do a date/time elapsed event rather
than a timer elapsed event.

Currently, I wrote my program to use a timer elapsed event set to 1
second, and it checks the date/time in the event. Is there a better
way?
Thanks.
Jan 2 '08 #1
Share this Question
Share on Google+
7 Replies


P: n/a
It all depends on what your task needs to achieve.

If you explain that, then you are likely to get the appropriate advice.
"wanwan" <er*******@yahoo.comwrote in message
news:63**********************************@e25g2000 prg.googlegroups.com...
Hi,

I'm looking for a better way to do a date/time elapsed event rather
than a timer elapsed event.

Currently, I wrote my program to use a timer elapsed event set to 1
second, and it checks the date/time in the event. Is there a better
way?
Thanks.
Jan 2 '08 #2

P: n/a
On Jan 2, 6:21 pm, "Stephany Young" <noone@localhostwrote:
It all depends on what your task needs to achieve.

If you explain that, then you are likely to get the appropriate advice.

"wanwan" <ericwa...@yahoo.comwrote in message

news:63**********************************@e25g2000 prg.googlegroups.com...
Hi,
I'm looking for a better way to do a date/time elapsed event rather
than a timer elapsed event.
Currently, I wrote my program to use a timer elapsed event set to 1
second, and it checks the date/time in the event. Is there a better
way?
Thanks.
my program allows setting actions running as one time events or
recurrent events(weekly, monthly ...). I think my current approach
(i.e. using one second timer) is very inefficient because there is no
need to do the check so frequently.

I need to know if there is anything in vb.net I can use where the
event is triggered by date and time.

Thanks.
Jan 3 '08 #3

P: n/a
Whatever you do, don't equate 'doing something frequently' with
'inefficient'.

Computers are designed to handle 'doing something frequently'. In fact
various parts of your computer are doing things 100's and even 1000's of
times every second.

Efficiency is more likely to be affected by what happens rather that how
often it happens.

The first thing you have to determine is the criticality of a task starting
on time.

By that I mean, is it critical that a task start precisely at a point in
time or is it acceptable that a task start within, say, 10 seconds of a
point in time.

If it is the latter than you can decrease the granularity of your timer to,
say, 10 seconds (10000 ms), instead of 1 second (1000 ms).
"wanwan" <er*******@yahoo.comwrote in message
news:d6**********************************@s12g2000 prg.googlegroups.com...
On Jan 2, 6:21 pm, "Stephany Young" <noone@localhostwrote:
>It all depends on what your task needs to achieve.

If you explain that, then you are likely to get the appropriate advice.

"wanwan" <ericwa...@yahoo.comwrote in message

news:63**********************************@e25g200 0prg.googlegroups.com...
Hi,
I'm looking for a better way to do a date/time elapsed event rather
than a timer elapsed event.
Currently, I wrote my program to use a timer elapsed event set to 1
second, and it checks the date/time in the event. Is there a better
way?
Thanks.

my program allows setting actions running as one time events or
recurrent events(weekly, monthly ...). I think my current approach
(i.e. using one second timer) is very inefficient because there is no
need to do the check so frequently.

I need to know if there is anything in vb.net I can use where the
event is triggered by date and time.

Thanks.
Jan 3 '08 #4

P: n/a
On Jan 2, 5:43*pm, wanwan <ericwa...@yahoo.comwrote:
On Jan 2, 6:21 pm, "Stephany Young" <noone@localhostwrote:


It all depends on what your task needs to achieve.
If you explain that, then you are likely to get the appropriate advice.
"wanwan" <ericwa...@yahoo.comwrote in message
news:63**********************************@e25g2000 prg.googlegroups.com...
Hi,
I'm looking for a better way to do a date/time elapsed event rather
than a timer elapsed event.
Currently, I wrote my program to use a timer elapsed event set to 1
second, and it checks the date/time in the event. Is there a better
way?
Thanks.

my program allows setting actions running as one time events or
recurrent events(weekly, monthly *...). I think my current approach
(i.e. using one second timer) is very inefficient because there is no
need to do the check so frequently.

I need to know if there is anything in vb.net I can use where the
event is triggered by date and time.

Thanks.- Hide quoted text -

- Show quoted text -
Use the Windows Task Scheduler....

http://www.mvps.org/emorcillo/en/cod...asksched.shtml

is just one possible interface...

--
Tom Shelton
Jan 3 '08 #5

P: n/a
On Jan 2, 8:40 pm, "Stephany Young" <noone@localhostwrote:
Whatever you do, don't equate 'doing something frequently' with
'inefficient'.

Computers are designed to handle 'doing something frequently'. In fact
various parts of your computer are doing things 100's and even 1000's of
times every second.

Efficiency is more likely to be affected by what happens rather that how
often it happens.

The first thing you have to determine is the criticality of a task starting
on time.

By that I mean, is it critical that a task start precisely at a point in
time or is it acceptable that a task start within, say, 10 seconds of a
point in time.

If it is the latter than you can decrease the granularity of your timer to,
say, 10 seconds (10000 ms), instead of 1 second (1000 ms).

"wanwan" <ericwa...@yahoo.comwrote in message

news:d6**********************************@s12g2000 prg.googlegroups.com...
On Jan 2, 6:21 pm, "Stephany Young" <noone@localhostwrote:
It all depends on what your task needs to achieve.
If you explain that, then you are likely to get the appropriate advice.
"wanwan" <ericwa...@yahoo.comwrote in message
>news:63**********************************@e25g200 0prg.googlegroups.com...
Hi,
I'm looking for a better way to do a date/time elapsed event rather
than a timer elapsed event.
Currently, I wrote my program to use a timer elapsed event set to 1
second, and it checks the date/time in the event. Is there a better
way?
Thanks.
my program allows setting actions running as one time events or
recurrent events(weekly, monthly ...). I think my current approach
(i.e. using one second timer) is very inefficient because there is no
need to do the check so frequently.
I need to know if there is anything in vb.net I can use where the
event is triggered by date and time.
Thanks.
Hi Steph,

what I mean is that my current approach is actually a form of polling.
It doesn't matter for one second timer or a ten second timer. For
example, a weekly event requires the program to run the event
repeatedly for a week before the computer actually does something
useful. Although modern computer can afford to waste these cycles,
it's still poor programming technique. Imagine what happens if I want
my program to handle 1000 weekly events with a precision of 1
millisecond?

what I am looking for is a way to wait on a date/time event based on
the concept of interrupt or blocking. So the program can better handle
large number of events.
I'm just hoping vb.net has something built in that I can use.
Eric
Jan 3 '08 #6

P: n/a
The answer is no, it doesn't.

See Tom's response re Task Scheduler.
"wanwan" <er*******@yahoo.comwrote in message
news:bf**********************************@t47g2000 hsd.googlegroups.com...
On Jan 2, 8:40 pm, "Stephany Young" <noone@localhostwrote:
>Whatever you do, don't equate 'doing something frequently' with
'inefficient'.

Computers are designed to handle 'doing something frequently'. In fact
various parts of your computer are doing things 100's and even 1000's of
times every second.

Efficiency is more likely to be affected by what happens rather that how
often it happens.

The first thing you have to determine is the criticality of a task
starting
on time.

By that I mean, is it critical that a task start precisely at a point in
time or is it acceptable that a task start within, say, 10 seconds of a
point in time.

If it is the latter than you can decrease the granularity of your timer
to,
say, 10 seconds (10000 ms), instead of 1 second (1000 ms).

"wanwan" <ericwa...@yahoo.comwrote in message

news:d6**********************************@s12g200 0prg.googlegroups.com...
On Jan 2, 6:21 pm, "Stephany Young" <noone@localhostwrote:
It all depends on what your task needs to achieve.
>If you explain that, then you are likely to get the appropriate
advice.
>"wanwan" <ericwa...@yahoo.comwrote in message
>>news:63**********************************@e25g20 00prg.googlegroups.com...
Hi,
I'm looking for a better way to do a date/time elapsed event rather
than a timer elapsed event.
Currently, I wrote my program to use a timer elapsed event set to 1
second, and it checks the date/time in the event. Is there a better
way?
Thanks.
my program allows setting actions running as one time events or
recurrent events(weekly, monthly ...). I think my current approach
(i.e. using one second timer) is very inefficient because there is no
need to do the check so frequently.
I need to know if there is anything in vb.net I can use where the
event is triggered by date and time.
Thanks.

Hi Steph,

what I mean is that my current approach is actually a form of polling.
It doesn't matter for one second timer or a ten second timer. For
example, a weekly event requires the program to run the event
repeatedly for a week before the computer actually does something
useful. Although modern computer can afford to waste these cycles,
it's still poor programming technique. Imagine what happens if I want
my program to handle 1000 weekly events with a precision of 1
millisecond?

what I am looking for is a way to wait on a date/time event based on
the concept of interrupt or blocking. So the program can better handle
large number of events.
I'm just hoping vb.net has something built in that I can use.
Eric
Jan 3 '08 #7

P: n/a
Wanwan,

It seems to me that your program (which is even not a Windows Service) has
to run everytime and the power should never goes down. (If it is a smaller
amount then you can calculate the ticks to that point and then set a timer
elapsing event to that point, but for a week this seems for me even to long
for a service). (Be aware that that timer event has as well to be processed,
however it is most probably faster than doing it yourself every time).

Have a look at the link that Tom is supporting around the scheduler.

Cor

Jan 3 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.