Re: More accurate Timerevent



Peter Ingham wrote:
On Tue, 21 Nov 2006 21:22:37 GMT, Dirk Claessens <No@xxxxxxxxxxx>
wrote:


On 2006-11-20, Gert Baars (62.194.53.8) wrote in
message <73d6e$4561b3d6$3ec23508$15065@xxxxxxxxxxxxxx>

Hello,

Thank you for info. I'd like to try timeSetEvent but Delphi 7 doesn't
recognize it and helpfunction neither. Do I need to add a .dcu at 'uses'? Is this somehow documented?

Gert,

Don't bother looking for it... it's a waist of time.
You **cannot** generate accurately timed events on a Windows platform. As others said: you need hardware.



On modern PC's, You are wrong, and the "others" you mention are also
wrong.


Try the following:



GetTickCount() has a resolution of 1 ms, so we would expect to see it's value incrementing by 1 ms or there about , right?


The value returned does have a resolution of 1 ms. The timer it is
measuring has a precision which is greater (10-15ms depending). You
simply are misunderstanding the behaviour characteristics of *one* of
the clocks available under Windows.

Time measurement, in any environment, is not a simple as most people
perceive.

For more info on time measurement in general, check out the NTP
reference material.

For a good discussion on PC Hardware Timers, Google for VMWare and
Timers.
--
Please remove '_SpamTrap' when replying. You know why :-(

Peter Ingham
Lower Hutt
New Zealand
you're wrong also.
The PC has always had an accurate time event +/- a bit because
they do have hardware clocks how ever, the even signaling to your
app is not going to happen on time. Windows does not halt every other
app, services and drivers at the time of the desired count for your app.
It will signal the app when it gets time. When doing a test
on the actual time that has past since the last time you checked the hardware clock, you will find that your event timing is all over the
place.
if you're trying to sample something at precise moments, this is not
going to work.
Point and case which has already been stated..
You need a hardware or a low level driver that handles the
IRQ of a timer from the PC or an add on board. all the sensitive
processing can be done then. even with that, you need to use a
board that can buffer up some data and place a mark at which point
where the event took place so that, later on it can be properly indexed
out.


Just think of trying to read a serial port RX pin signal and try to time that using that method in software under windows.




--
"I'm never wrong, once i thought i was, but was mistaken"
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5

.



Relevant Pages

  • Re: Do-Nothing WinForm App Using 4 Threads?
    ... Windows CE). ... | refactoring a multi-threaded GUI app at work and want to be sure it's ... I expected a timer to be on its own ... And the event handling from remote objects ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Strange timer problem
    ... instead of "hardware" and by "hardware" I meant almost ... If I set the timer to be signaled after 1 ms, ... Since windows is not an RTOS I would ... But expecting those notifications to be ...
    (microsoft.public.vc.mfc)
  • XPe time is loosing 12 seconds per minute.
    ... We have new custom hardware that is working well except that we are loosing ... then keeps track of the time/date using a periodic timer. ... What timer is Windows using for time/date? ...
    (microsoft.public.windowsxp.embedded)
  • Re: RB 5.5.5, Windows: quit method strange
    ... there is a timer that's running. ... What's interesting is that when I've seen this happen, ... to have quit--no windows or any other visual indication that the app ... Art, photography, shareware, polyamory, literature, kink: ...
    (comp.lang.basic.realbasic)
  • Re: Windows did not start successfully
    ... Running Windows XP Home edition with SP2, but struggling to get the operating system loaded! ... 'Windows did not start properly' screen came up but I have yet to continue beyond here....the timer does it's countdown to 0 then does nothing, or if I make a selection and press 'return' or 'enter', the screen freezes with the timer stopping on whatever number of seconds it reached!! ... An easy way to check if hardware is the issue is by booting with a Linux live CD such as Knoppix. ...
    (microsoft.public.windowsxp.general)