Re: [PATCH v2 2/2] libc/include/time.h: Added protoype for timespec_get() to time.h

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Hi Mazen,

On May 12 01:29, Mazen Adel Elmessady wrote:
> Adds the declaration of the C11 function timespec_get() to time.h.
> This supports C11 standard compliance and contributes to POSIX Issue 8 alignment.
> ---
>  newlib/libc/include/time.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h
> index ab3491341..33cf40049 100644
> --- a/newlib/libc/include/time.h
> +++ b/newlib/libc/include/time.h
> @@ -57,6 +57,9 @@ clock_t	   clock (void);
>  double	   difftime (time_t _time2, time_t _time1);
>  time_t	   mktime (struct tm *_timeptr);
>  time_t	   time (time_t *_timer);
> +#if __STDC_VERSION__ >= 201112L
> +int        timespec_get(struct timespec *ts, int base);
> +#endif
>  #ifndef _REENT_ONLY
>  char	  *asctime (const struct tm *_tblock);
>  char	  *ctime (const time_t *_time);
> -- 
> 2.45.2

This patch is incomplete:

- There's already a definition of timespec_get() inside Cygwin's
  cygwin/time.h which should be removed by this patch, too.

- The patch should check for __ISO_C_VISIBLE >= 2011 rather than
  checking __STDC_VERSION__.

- The patch is missing the definition of TIME_UTC, which is an integral
  part of of the definition of timespec_get().


Thanks,
Corinna
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.