Return to KLUBNL.PL main page

rsgb_lf_group
[Top] [All Lists]

LF: Re: Timing GPS

To: [email protected]
Subject: LF: Re: Timing GPS
From: "Alberto di Bene" <[email protected]>
Date: Sat, 14 Feb 2004 16:19:19 +0100
In-reply-to: <[email protected]>
References: <[email protected]>
Reply-to: [email protected]
Sender: <[email protected]>
User-agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
[email protected] wrote:

[...]
With programs no longer having direct access to the hardware, the time is whatever Windows says it is. I expect there are still ways to trigger reading of the system clock, but there will always be slippage of an unknown number of "ticks", depending on what processes are running and what priority they have.
[...]
Maybe there is a way out. In Windows, both 98 and XP, there is API called QueryPerformanceCounter. From the help:

The QueryPerformanceCounter function retrieves the current value of the high-resolution performance counter, if one exists.

The last sentence "if one exists", is justified by the fact that this *hardware* counter has been implemented in CPUs
not older that the Pentium II, or the AMD K7, if memory serves.
This counter is a 64-bit register in the CPU core, incremented by a 1,193,180 Hz clock, about 0.838 us resolution. Being hardware, it is not affected by the scheduling priorities of Windows, so it is quite accurate. It's main drawback is that you cannot use it to generate interrupts, you have to poll it to read its value. The main FFT buffers shifting and sheduling timing in Spectran is done using this counter, so I know by experience that it works. Windows docs suggest to use the API QueryPerformanceFrequency to know the actual clock frequency used to increment that counter, but I have found that, at least on all the PCs I have tested, it always
returns the value of 1,193,180 Hz.

73  Alberto  I2PHD





<Prev in Thread] Current Thread [Next in Thread>