[avahi] [PATCH] Support for monotonic clock

Marc Bodmer marc.bodmer at email.ch
Thu Apr 2 13:33:27 PDT 2015


Hi Trent
 
I think it is a good idea to even make it possible to use CLOCK_BOOTTIME
where appropriate.
 
In my opinion it should be a configure time option which clock source
Avahi uses for which purpose.
For example to measure elapsed time CLOCK_MONOTONIC or CLOCK_BOOTTIME
should be used, for other purposes CLOCK_REALTIME might be more
appropriate.
 
Care should be taken to also allow running the newest Avahi version
with older kernels, which may not support for these newer clock sources
yet.
 
Especially embedded systems may not be able to freely use the newest
kernels/kernel features. The best available clock source should be used
by configure or be configured by the user.

An inspiration might be how dbus has abstracted it’s time sources:
_dbus_get_monotonic_time
_dbus_get_real_time
 
It certainly also is a good idea to further analyze the usage of
timestamps within Avahi. I have only patched the core to avoid the
observed misbehaviour when time was stepped back.
 
There is other usage of timestamps where I was not certain what time
would be appropriate. This would need further analysis. Especially
timeouts needed for dbus calls are such another place.
 
I am not planning further effort for now. If you however need some
help in testing on older kernels and embedded systems I would offer
my support.

Regards
Marc

Am Mittwoch, den 01.04.2015, 11:22 +0800 schrieb Trent Lloyd:
> Hi Marc,
> 
> 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.
> 
> Cheers,
> Trent




More information about the avahi mailing list