PC Review


Reply
Thread Tools Rate Thread

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

 
 
=?Utf-8?B?R29yZG9u?=
Guest
Posts: n/a
 
      14th Aug 2006
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
 
Reply With Quote
 
 
 
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      14th Aug 2006
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" <(E-Mail Removed)> schreef in bericht
news:BB185AE5-1314-4158-8FF3-(E-Mail Removed)...
> 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



 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      14th Aug 2006
Gordon,

Reading your message again,

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

I hope this helps,

Cor

"Gordon" <(E-Mail Removed)> schreef in bericht
news:BB185AE5-1314-4158-8FF3-(E-Mail Removed)...
> 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



 
Reply With Quote
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      14th Aug 2006
Gordon,
It sounds like you want to use Sleep as Cor suggests:

Threading.Thread.Sleep(TheRelieveTimeInMilliSeconds)

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" <(E-Mail Removed)> wrote in message
news:BB185AE5-1314-4158-8FF3-(E-Mail Removed)...
| 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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
clock or timer on slide larry S Microsoft Powerpoint 3 17th Dec 2008 02:29 AM
Clock and Countdown Timer =?Utf-8?B?QmxhY2tfZHJhaGdv?= Microsoft Frontpage 1 30th May 2006 12:58 PM
Using timer as Alarm clock =?Utf-8?B?T2xzemFuc2tpQQ==?= Microsoft Access VBA Modules 4 19th Jan 2006 06:55 PM
Not clock but elapsed timer... technomaNge Freeware 7 17th Oct 2004 06:40 PM
Re: Clock or timer resti Microsoft Access VBA Modules 0 28th Jun 2003 02:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:50 PM.