[avahi] [PATCH] Support for monotonic clock
lathiat at bur.st
Tue Mar 31 20:22:22 PDT 2015
Thanks for the patch! It looks like a good idea to make some adjustments to the clock source here.
Looking at clock_gettime, it might make sense to sometimes use CLOCK_BOOTTIME so that for example records expire correctly once coming out of suspend.
A little more in depth analysis of what timestamps are being used for where would be required to check that this time would be suitable in all cases and wouldn’t result in multiple triggers, etc.
We need also to consider the clocks used in avahi-gobject, which I am actually currently changing because g_source_get_current_time is deprecated and make sure that generally we don’t compare two different clock sources anywhere.
I guess I will take a look at that but if you have any more thoughts in the mean time please chime in.
> On 12 Mar 2015, at 6:02 am, Marc Bodmer <mb0dm3r at gmail.com> wrote:
> Hi, on our 32bit Linux embedded systems Avahi stopped publishing
> services when time was stepped backwards.
> This was due to Avahi using gettimeofday() to measure elapsed time. This
> function takes it's values from CLOCK_REALTIME. However to measure
> elapsed time CLOCK_MONOTONIC should be used instead to prevent
> unpredictable behaviour. My attached patch here fixes this.
> avahi mailing list
> avahi at lists.freedesktop.org
More information about the avahi