[time-nuts] [Solved] Looking for multiple PPS timestamp logging
albertson.chris at gmail.com
Tue Oct 4 12:23:42 EDT 2011
On Tue, Oct 4, 2011 at 3:36 AM, Hal Murray <hmurray at megapathdsl.net> wrote:
>> The temperature swings won't be large, just the usual diuneral indoor cycles.
> In California, the diurnal temperature swings are big enough to be useful. :)
> This is what ntp sees the main/CPU crystal doing in a non airconditioned
> room. Each color is a different day.
> The swing would be much bigger outside, especially with an open sky.
>> Since we'd be measuring 4 PPS signals that won't be in phase, I wasn't
>> planning on sleeping for long. But, I some 10 usec sleeps with usleep(10000)
>> after reading a pulse would be reasonable. But, with the system not doing
>> anything but polling and writing to the disk, I wasn't expecting much
>> interruptions from other processes.
> I was thinking of keeping track of when you expected each pulse to arrive
> next and sleeping until a little before you expected the soonest one.
> (Adjust "a little" by trial and error.)
This is a UNIX-like system? If so use a "select" on the file
descriptor(s). This system call allows you to sleep until there is
data available on one of a set of files. See "man 2 select"
The code right after the select() has to poll all the files to see
which one has data, your read/process it then go back an wait/sleep.
If you do poll after a fixed length sleep you will on average to 1/2
of a polling cycle late reading the data and also you waste time
checking when nothing is there.
Redondo Beach, California
More information about the time-nuts