Re: Question on expiring HRtimer in-kernel

From: Linus Walleij
Date: Thu Mar 03 2022 - 17:55:28 EST


On Thu, Mar 3, 2022 at 1:43 PM Matti Vaittinen <mazziesaccount@xxxxxxxxx> wrote:

> In any case, I remember few cases where I hit nasty issues because I
> used CLOCK_REALTIME - which (AFAIR) is subject to the time adjustments.
> NTP, GPS-time and so on can make the time tick in a strange way :) I
> guess you would have noticed if time was set when timer did expire.
>
> Anyways, I guess the battery charging should rather be tied CLOCK_MONOTONIC.

That makes a lot of sense, and is what I have learned from the internal
kernel primitives as well, I just assumed the HRTimer was some special
kind of beast.

I'll patch this and run some testing, if it goes away with MONOTONIC
I'll send a patch. Thanks!

Yours,
Linus Walleij