long-run repeatly timer?

Jeff Shannon jeff at ccvcorp.com
Fri Nov 12 14:06:01 EST 2004


Qiangning Hong wrote:

> I am implementing a long-run sample-and-record system.  It collects 
> data from a PCI card every 10 seconds, saves the data (timestamped 
> with the current system time) in the hard disk, and shows them on the 
> screen. There is also a GPS receiver module exists on the system, 
> which correct the system time (and the hardware time) when it drifts 
> away too much, however, I can not access the source code of this module.


I think that, in order to do this, you may need to discover when the 
system time has been adjusted and explicitly correct for that.  Given 
that system time is the only real source of timing information that you 
have (because any other sources are going to be derived from that), 
you're going to have a hard time doing anything that's more accurate 
than your (possibly self-corrected) system time.

Is there a way to get the GPS module to inform other programs when it 
adjusts time?  Is there a maximum/minimum time delta that it will 
apply?  Does it only correct the system time at specific intervals?

Actually, if you can write a C extension (or if there's a preexisting 
Windows API call that you can use through ctypes), you might be able to 
hook into the hardware clock-tick interrupt and count ticks yourself, 
deriving your own time with a little bit of math.  You'd probably need 
to sync periodically with the system clock, anyhow, to make sure that 
your tick count isn't drifting, but it would give you independence from 
the sudden discontinuities in the system time from being reset by the 
GPS module.

Jeff Shannon
Technician/Programmer
Credit International




More information about the Python-list mailing list