[PATCH] Add timegm POSIX call [updated]

Corinna Vinschen vinschen@redhat.com
Fri Aug 24 11:29:00 GMT 2018


On Aug 23 12:56, Andrew Russell via newlib wrote:
> >From 45939beb4546d0bc005062e30c05cfea88e6bf47 Mon Sep 17 00:00:00 2001
> From: Andrew Russell <ahrussell@google.com>
> Date: Thu, 23 Aug 2018 11:10:21 -0700
> Subject: [PATCH 1/1] Refactor mktime and add the POSIX function timegm
> 
> Updated with appropriate version-gating of the timegm() symbol from time.h
> 
> ---
>  newlib/libc/include/time.h   |  3 ++
>  newlib/libc/saber            |  1 +
>  newlib/libc/time/Makefile.am |  2 +
>  newlib/libc/time/Makefile.in | 11 ++++-
>  newlib/libc/time/local.h     |  2 +
>  newlib/libc/time/mktime.c    | 81 +++++++++++++++++++++++++-----------
>  newlib/libc/time/timegm.c    | 63 ++++++++++++++++++++++++++++
>  7 files changed, 138 insertions(+), 25 deletions(-)
>  create mode 100644 newlib/libc/time/timegm.c
> 
> diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h
> index a2efcc15e..e5e151881 100644
> --- a/newlib/libc/include/time.h
> +++ b/newlib/libc/include/time.h
> @@ -56,6 +56,9 @@ struct tm
>  clock_t    clock (void);
>  double    difftime (time_t _time2, time_t _time1);
>  time_t    mktime (struct tm *_timeptr);
> +#if defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || defined(_GNU_SOURCE)

This is not correct.  Don't use the _XXX_SOURCE macros in the header
files, use the __XXX_VISIBLE macros instead.  Please have a look at the
descriptive comments in newlib/libc/include/sys/features.h and compare
with other usages of the __XXX_VISIBLE macros.

Btw., _BSD_SOURCE and _SVID_SOURCE are deprecated, as on Linux.  That's
_DEFAULT_SOURCE these days (but see above).


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20180824/cda13716/attachment.sig>


More information about the Newlib mailing list