Does it make sense to change boost::asio::deadline_timer to steady_timer?

Ed Tanous edtanous at google.com
Thu Mar 10 03:22:19 AEDT 2022


On Wed, Mar 9, 2022 at 6:16 AM Heyi Guo <guoheyi at linux.alibaba.com> wrote:
>
> Hi all,
>
> We can see lots of using boost::asio::deadline_timer in the code, like
> dbus-sensors. However, this timer is based on UTC clock and might be
> affected by system time. I tested and found the timer didn't trigger in
> time if I changed system time to some early time after starting the
> timer (calling expire_from_now()). And I think this situation might
> happen if system time of BMC is synchronized with host or NTP.
>
> At the other hand, steady_timer is a chrono timer and should not be
> affected by system time.
>
> Is there any reason to use deadline_timer for relative timer trigger?
> Shall we switch to steady_timer to avoid being affected by system time
> change?

Yes, these should be steady_timer.  For some reason I thought we fixed
this a long time ago in dbus-sensors, but apparently not.  Please send
the other maintainers and I a patch in gerrit (should be just a sed
replace of all deadline_timer instances) and I'll review it.

>
> Thanks,
>
> Heyi
>


More information about the openbmc mailing list