473,659 Members | 3,395 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

date/time elapsed event

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
7 2228
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*******@yaho o.comwrote in message
news:63******** *************** ***********@e25 g2000prg.google groups.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
On Jan 2, 6:21 pm, "Stephany Young" <noone@localhos twrote:
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...@yaho o.comwrote in message

news:63******** *************** ***********@e25 g2000prg.google groups.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
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*******@yaho o.comwrote in message
news:d6******** *************** ***********@s12 g2000prg.google groups.com...
On Jan 2, 6:21 pm, "Stephany Young" <noone@localhos twrote:
>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...@yaho o.comwrote in message

news:63******* *************** ************@e2 5g2000prg.googl egroups.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
On Jan 2, 5:43*pm, wanwan <ericwa...@yaho o.comwrote:
On Jan 2, 6:21 pm, "Stephany Young" <noone@localhos twrote:


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...@yaho o.comwrote in message
news:63******** *************** ***********@e25 g2000prg.google groups.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
On Jan 2, 8:40 pm, "Stephany Young" <noone@localhos twrote:
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...@yaho o.comwrote in message

news:d6******** *************** ***********@s12 g2000prg.google groups.com...
On Jan 2, 6:21 pm, "Stephany Young" <noone@localhos twrote:
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...@yaho o.comwrote in message
>news:63******* *************** ************@e2 5g2000prg.googl egroups.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
The answer is no, it doesn't.

See Tom's response re Task Scheduler.
"wanwan" <er*******@yaho o.comwrote in message
news:bf******** *************** ***********@t47 g2000hsd.google groups.com...
On Jan 2, 8:40 pm, "Stephany Young" <noone@localhos twrote:
>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...@yaho o.comwrote in message

news:d6******* *************** ************@s1 2g2000prg.googl egroups.com...
On Jan 2, 6:21 pm, "Stephany Young" <noone@localhos twrote:
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...@yaho o.comwrote in message
>>news:63****** *************** *************@e 25g2000prg.goog legroups.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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2028
by: Marc | last post by:
I've got a PHP script that's using fopen to connect to a remote web server and pick up data. I've run into a problem in calculating elapsed time. The remote web server outputs a time and I'd like to calculate the difference between that time and the current time. The problem is that the time on the remote server isn't in sync with the time on my server (off by about 5 minutes) and this throws off the elapsed time calculations. I know...
3
1855
by: rhaley | last post by:
ugh. Okay, I need to figure out the number of milliseconds between DateTime.Now and the end of the day so that I can make changes based on the date roll-over. I need to implement a Timer so that I can process things on the Timer.Elapsed event that would happen right at the date change (unless there is a better suggestion to implement an event on the date change). DateTime isn't so friendly to this calculation. Please, any suggestions are...
16
3840
by: Tim Davidge | last post by:
Hi folks, been a while since I have posted a plea for help and I think I have forgotten everything I learnt from the helpful contributors to this newsgroup, that said however : I'm trying to insert a range of dates for the past say two years into the first column of say a two column table. I've been trying to use 'current date' and working backwards from there but for the life of me I cannot get the syntax right. I can produce a single...
1
1782
by: untiroalaire | last post by:
Hi, here's what I'd like to do: get the time difference (Elapsed) between the "received date" field for all emails (running total) I've dumped into access from outlook and summarize at the end. so, sample input:
0
1115
by: Microsoft | last post by:
I'm creating a service and am using a timer in it. When the service starts I enable the timer, and then in the timer elasped event, I'm disabling it (this.srvcTimer.Enabled = false) so the timer event doesn't fire while I'm already in it. At the end of the timer elapsed event I re-enable it. However, while running in the debugger, the event never fires. If I comment out the line disabling the timer in the elapsed event, the event fires. ...
0
1810
by: Anurag | last post by:
Hi, ENV: DB2 ESE 8.2.3 DPF (11 nodes) on AIX 5.x ==== SCENARIO / SETUP ======== ====== (1) I needed to find out CPU Time (User / System) of SQL queries for benchmark testing. (2) I setup an EVENT MONITOR WHERE AUTH_ID = 'ANURAG' (write to table).
1
1736
by: Rush | last post by:
hey, I am working on creating a countdown from the current date to a specified date later on, using days, hours, minutes, and seconds, updating every second. I have been searching and searching, and I have figured out how to get the current date. The problem is, I don't know how to use the new "Timer" that comes with visual studio 2005. so, now that i have the current date, i don't know how to count down to the future date. can anyone...
0
6459
by: simplediscourse | last post by:
i'm trying to demonstrate timeslicing among equal high priority threads without putting threads to sleep. to do this i'm trying to run a timer while executing a very long loop sequence in order to get the processor to round-robin through the high priority threads. here's what i have: static void Main(string args) { System.Timers.Timer aTimer = new System.Timers.Timer(); // Hook up the Elapsed event for the timer. aTimer.Elapsed += new...
5
1947
by: mmi48 | last post by:
Most of the discussions I've seen about elapsed time have, thus far, involved at least two date/time fields. I am trying to calculate time elapsed from one field across multiple records. The field is a timestamp field. How can I calculate the time elapsed from one timestamp to the next?
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8337
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8531
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7359
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.