473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How do I get the a timedate value to the ws timer clock ?

Hi;

I am trying to give my CPU some relief from comparing a group of values to
now() while looping through an array. I tried using the windows.system.timer
but i have been unable to find the correct interval that will allow a match
as in
compare("08/14/2006 10:30:00 AM", Now) = 0. in the tick event.

I tired looking into the server oriented timer but it only has an elasped
event and that's not what I need.

Do i even need a time to pause my CPU access ? Could I just not use a DO
Loop to
pause the iterations of my For next ?

Thanks

--
Gordon
Aug 13 '06 #1
3 1186
Gordon,

First a question, do you have any reason to use the windows.system timer
instead of the simple windows.forms.timer?

In other words, is this timer used in a simple single threaded forms
application or in another way?

Cor

"Gordon" <Go****@discussions.microsoft.comschreef in bericht
news:BB**********************************@microsof t.com...
Hi;

I am trying to give my CPU some relief from comparing a group of values to
now() while looping through an array. I tried using the
windows.system.timer
but i have been unable to find the correct interval that will allow a
match
as in
compare("08/14/2006 10:30:00 AM", Now) = 0. in the tick event.

I tired looking into the server oriented timer but it only has an elasped
event and that's not what I need.

Do i even need a time to pause my CPU access ? Could I just not use a DO
Loop to
pause the iterations of my For next ?

Thanks

--
Gordon

Aug 14 '06 #2
Gordon,

Reading your message again,

Probably the simple
\\\
Threading.Thread.Sleep(TheRelieveTimeInMilliSecond s)
///
Gives what you want to do.

I hope this helps,

Cor

"Gordon" <Go****@discussions.microsoft.comschreef in bericht
news:BB**********************************@microsof t.com...
Hi;

I am trying to give my CPU some relief from comparing a group of values to
now() while looping through an array. I tried using the
windows.system.timer
but i have been unable to find the correct interval that will allow a
match
as in
compare("08/14/2006 10:30:00 AM", Now) = 0. in the tick event.

I tired looking into the server oriented timer but it only has an elasped
event and that's not what I need.

Do i even need a time to pause my CPU access ? Could I just not use a DO
Loop to
pause the iterations of my For next ?

Thanks

--
Gordon

Aug 14 '06 #3
Gordon,
It sounds like you want to use Sleep as Cor suggests:

Threading.Thread.Sleep(TheRelieveTimeInMilliSecond s)

To find TheRelieveTimeInMilliSeconds you can use simple subtraction.

Dim theDate As Date = #8/14/2006 10:30:00 AM#

Dim theTimeSpan As TimeSpan = theDate - DateTime.Now

System.Threading.Thread.Sleep(theTimeSpan)

NOTE: Sleeps accepts either a TimeSpan or a Integer. I find using the
TimeSpan above more "convenient".

If you need a Timer, and want to to start at a specific time, you can use
System.Threading.Timer, where you pass theTimeSPan from above to the dueTime
on the System.Threading.Timer constructor.

Dim timer As New System.Threading.Timer(AddressOf OnElapsed,
Nothing, theTimeSpan, period)

If you set the period parameter to -1 milliseconds the event will fire once.

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Gordon" <Go****@discussions.microsoft.comwrote in message
news:BB**********************************@microsof t.com...
| Hi;
|
| I am trying to give my CPU some relief from comparing a group of values to
| now() while looping through an array. I tried using the
windows.system.timer
| but i have been unable to find the correct interval that will allow a
match
| as in
| compare("08/14/2006 10:30:00 AM", Now) = 0. in the tick event.
|
| I tired looking into the server oriented timer but it only has an elasped
| event and that's not what I need.
|
| Do i even need a time to pause my CPU access ? Could I just not use a DO
| Loop to
| pause the iterations of my For next ?
|
| Thanks
|
| --
| Gordon
Aug 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Robert Misiak | last post by:
In a program that I wrote, it is very important for the user to have the correct time zone configured. As such, in its properties window I display the current configured time zone, and if it is...
8
by: theinvisibleGhost | last post by:
I think I've found a bug in the timer control. I've got a class which uses a timer control. It imports it from System.Windows.Forms This timer ticks once a second, and then updates a label...
9
by: Tolga Tanriverdi | last post by:
I wrote a program which includes a timer event in it but if my program executes on windows 98 the timer event is not running is something like that possible Thanks
5
by: Brett | last post by:
If I use the following code, the declaration is fine. //no namespace private System.Timers.Timer Clock; This gives the error, "'Timer' is an ambiguous reference". using System.Timers; ...
9
by: HL | last post by:
I am using VS 2005 Beta - C# Problem: The Timer fires a few milliseconds before the actual Due-Time Let's say a timer is created in the following manner: System.Threading.Timer m_timer = null;...
7
by: Mike Eaton | last post by:
Hi All, I have a simple application that allows users to clock in and out and stores the data for use by the payroll department. It spends most of its life as a tray icon and when the user...
8
by: Stephen Rice | last post by:
Hi, I have a periodic problem which I am having a real time trying to sort. Background: An MDI VB app with a DB on SQL 2000. I have wrapped all the DB access into an object which spawns a...
19
by: UG | last post by:
I just wanted to know whether any timer facility exists in C, as it is not mentioned in K&R 2, or in the ISO Draft. By timer function i mean that when we use standard input function like scanf() or...
1
by: Joseph Gruber | last post by:
Hi all. I'm looking for some help here. My app creates a runtime label which is used as a clock -- it also then creates the timer for this clock at runtime. When the timer tick's clockUpdate is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...

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.