Hi Chris, select is a great idea, but I think I'll be using cygwin which doesn't appear to have an emulation of select on Windows.
Kevin On Oct 4, 2011, at 10:23 AM, Chris Albertson wrote: > On Tue, Oct 4, 2011 at 3:36 AM, Hal Murray <hmur...@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. >> http://www.megapathdsl.net/~hmurray/ntp/slope.gif >> >> 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. > > Chris Albertson > Redondo Beach, California > > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there. > _______________________________________________ time-nuts mailing list -- time-nuts@febo.com To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts and follow the instructions there.