Date: Sat, 19 Nov 2022 13:31:45 -0500 From: Rich Felker <dalias@...c.org> To: 罗勇刚(Yonggang Luo) <luoyonggang@...il.com> Cc: musl@...ts.openwall.com, Jens Gustedt <jens.gustedt@...ia.fr>, Jason Ekstrand <jason@...kstrand.net> Subject: Re: C23 implications for C libraries On Sat, Nov 19, 2022 at 04:46:22AM +0800, 罗勇刚(Yonggang Luo) wrote: > There is a concept called CLOCK_MONOTONIC_RAW (since Linux 2.6.28; > Linux-specific), > May C2x provide TIME_MONOTONIC_RAW in future or can we just implement > TIME_MONOTONIC with > CLOCK_MONOTONIC_RAW on Linux? When implement mesa vulkan driver, it's ask > for CLOCK_MONOTONIC_RAW at > > https://gitlab.freedesktop.org/mesa/mesa/-/blob/c6c5949ff70a47c47795fe9161a7514173b5be24/src/vulkan/runtime/vk_device.c#L557 > > May intention is using C2x timespec_get to replace function > vk_clock_gettime but it's lack of TIME_MONOTONIC_RAW, so I don't know > what's the best way The code there is already doing exactly what it should do in the case where CLOCK_MONOTONIC_RAW is not defined so I'm not sure what you're trying to achieve. On a system where CLOCK_MONOTONIC_RAW is defined, the caller may have (for likely-nonsensical reasons) chosen to pass CLOCK_MONOTONIC_RAW, and they're handling the case where the kernel is too old to have that extension clock by substituting CLOCK_MONOTONIC instead. If CLOCK_MONOTONIC_RAW is not defined, then most certainly the caller did not pass it (since there's no such thing) and thus there is no need for any fallback code. No action is needed at all here. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.