Re: Container Uptime Discussion

"Craig Small" <[email protected]> ("csmall") Sun, 11 Feb 2024 14:30:23 +1100
Newsgroups gmane.linux.procps.devel
Message-ID <CALy8Cw54=wp1ni9GOzNiA4tVn2GSsqiaEBuHyTNK9s2j3zfqkA@mail.gmail.com>
--000000000000e0da11061112c8f1
Content-Type: text/plain; charset="UTF-8"

On Sat, 10 Feb 2024 at 05:37, Jim Warner <[email protected]> wrote:

> Don't do anything fancy because what you've got now works just fine
> under both docker and lxc (besides, the above is backwards).  Using the
> C standard clock_gettime equalized things and was the perfect solution.
>
Cool, I'll leave that alone.


> > Perhaps boot_time in the library should use clock_gettime()?
>
> The attached patch does just that.  Thanks for paving the way.
>
That's commited.


> I ran it under the three above containers.  It always shows the host
> "uptime".  Do you plan to abandon all use of /proc/uptime?
>
I think for when something asks for uptime we use /proc/uptime. When we are
comparing things against the system boot time we use clock_gettime().
I suspect the library does both those things now.

 - Craig

--000000000000e0da11061112c8f1
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">On Sat, 10 Feb 2024 at 05:37, Jim Warner =
&lt;<a href=3D"mailto:[email protected]">[email protected]</a=
>&gt; wrote:</div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quo=
te" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204=
);padding-left:1ex">
Don&#39;t do anything fancy because what you&#39;ve got now works just fine=
 <br>
under both docker and lxc (besides, the above is backwards).=C2=A0 Using th=
e <br>
C standard clock_gettime equalized things and was the perfect solution.<br>=
</blockquote><div>Cool, I&#39;ll leave that alone.</div><br><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid =
rgb(204,204,204);padding-left:1ex">
<br>
&gt; Perhaps boot_time in the library should use clock_gettime()?<br>
<br>
The attached patch does just that.=C2=A0 Thanks for paving the way.<br></bl=
ockquote><div>That&#39;s commited.</div><div>=C2=A0<br></div><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid=
 rgb(204,204,204);padding-left:1ex">
I ran it under the three above containers.=C2=A0 It always shows the host <=
br>
&quot;uptime&quot;.=C2=A0 Do you plan to abandon all use of /proc/uptime?<b=
r></blockquote><div>I think for when something asks for uptime we use /proc=
/uptime. When we are comparing things against the system boot time we use c=
lock_gettime().</div><div>I suspect the library does both those things now.=
</div><div><br></div><div>=C2=A0- Craig</div><br></div></div>

--000000000000e0da11061112c8f1--