select on udp recvfrom doesn't work ???

Mike el.fontanero-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Wed Aug 11 15:24:27 UTC 2010


On Wed, Aug 11, 2010 at 11:03 AM, Dave Cramer <davec-zxk95TxsVYDyHADnj0MGvQC/G2K4zDHf at public.gmane.org> wrote:
>> Do you have any timer sources?  Do you want to do the sync from user
>> space or kernel space?
>
> Yes, I have timer resources including a very high resolution counter
> inside the arm chip itself, but it currently does not generate
> interrupts.
>
> If I have to I will go to kernel space. I expect I will have to but
> for now this is exploratory.
>
>>
>> The rtc is just one possible source (although often x86 only).
>>
>> Have a look at:
>>
>> man 2 timer_create
>> man 2 timer_settime
>>
>> Those allow creating a regularly scheduled timer that calls a function
>> at a regular interval.  It does allow fairly small timer intervals, so
>> perhaps you could make it run every 1ms or so and see if that is good
>> enough to do the job.
>>
>> So if every time the timer fires you do a non blocking read on your
>> network socket to see if you got a start message, then you can start
>> from there.
> I only want to use the udp message to sync the timers every once a day
> or so. Other than that I just want to use the timers.
>
> I don't want to consume the bandwidth.
>

You might still want to consider using NTP to synchronize all your
devices' clocks with respect to each other, even if you don't have an
external (i.e. Internet) reference. The risk of running without a
proper reference would be that your whole network's time might drift
(in unison, mind you) by a few ppm. If your reference already had a
'drift file', created by NTP to account for your system oscillator's
drift, you could mitigate this by an order of magnitude.

In any case, once your network was internally synchronized, you could
then use local timer facilities to reliably refer to  the local clock
and be confident of response within O(ms).

Cheers,
Mike L
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list