[PATCH v2] time: Add TIME_MONOTONIC, TIME_ACTIVE, and TIME_THREAD_ACTIVE
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Tue Nov 25 12:42:11 GMT 2025
On 25/11/25 05:35, Florian Weimer wrote:
> * Adhemerval Zanella:
>
>> The TIME_MONOTONIC maps to POSIX's CLOCK_MONOTONIC, TIME_ACTIVE to
>> CLOCK_PROCESS_CPUTIME_ID, and TIME_THREAD_ACTIVE to
>> CLOCK_THREAD_CPUTIME_ID.
>>
>> No Linux specific timer are added as extension.
>
> I think we should come up with some general transformation of the clock
> ID values. It would help us if WG14 lifted the requirement that clock
> IDs must be positive integers. The interfaces they defined merely
> require that valid clock IDs are not zeros. Once negative values are
> permitted, we only have to special-case the zero value. New clocks then
> are just a matter of kernel support and defining the appropriate
> constants in a header file.
At least for Linux/POSIX we can currently assume a direct mapping between
C timebase and POSIX clockid. What I am not sure is if we should add
GNU extensions to transform between clocks, like the timebase_to_clockid
and clockid_to_timebase proposed early for this feature.
>
> Would someone in the ISO system please submit a DR? I think for us,
> permitting negative values would work, as would making the clock base
> type unsigned.
I think this is reasonable.
More information about the Libc-alpha
mailing list