[PATCH v2 2/4] time: Implement c23 timespec_get base
Joseph Myers
joseph@codesourcery.com
Tue Jun 20 20:37:52 GMT 2023
On Wed, 21 Jun 2023, Yonggang Luo via Libc-alpha wrote:
> #ifdef __USE_ISOC11
> /* Time base values for timespec_get. */
> -# define TIME_UTC 1
> +# define TIME_UTC 1
> +# define TIME_MONOTONIC 2
> +# define TIME_ACTIVE 3
> +# define TIME_THREAD_ACTIVE 4
These should be conditional on C2x.
> +# define TIME_MONOTONIC_RAW 5
> +# define TIME_UTC_COARSE 6
> +# define TIME_MONOTONIC_COARSE 7
> +# define TIME_BOOTTIME 8
> +# define TIME_UTC_ALARM 9
> +# define TIME_BOOTTIME_ALARM 10
> +# define TIME_SGI_CYCLE 11
> +# define TIME_TAI 12
And adding these is questionable; certainly any extension to these
interfaces would need properly documenting (i.e. with what glibc defines
the semantics to be, *not* what the Linux kernel defines some CLOCK_*
semantics to be), and if added, it would be appropriate for them to be
conditional on __USE_GNU.
> + case TIME_BOOTTIME:
> + clockid = CLOCK_BOOTTIME;
> + break;
> + case TIME_UTC_ALARM:
> + clockid = CLOCK_REALTIME_ALARM;
> + break;
> + case TIME_BOOTTIME_ALARM:
> + clockid = CLOCK_BOOTTIME_ALARM;
> + break;
These don't exist in bits/time.h; try building for Hurd with
build-many-glibcs.py.
> + case TIME_SGI_CYCLE:
> + clockid = CLOCK_SGI_CYCLE;
> + break;
And this doesn't exist in glibc at all. Is a Linux kernel uapi header
included somehow?
> + case TIME_TAI:
> + clockid = CLOCK_TAI;
> + break;
Again, I'd expect this to break the build for Hurd.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list