public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: <libc-alpha@sourceware.org>
Subject: Declare timegm for ISO C2X
Date: Wed, 1 Jun 2022 23:08:47 +0000	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2206012307340.3755786@digraph.polyomino.org.uk> (raw)

The next revision of the ISO C standard has added the timegm function
(that was already supported in glibc).  Update the feature test
conditionals on its declaration in <time.h> accordingly.

Tested for x86_64.

diff --git a/time/time.h b/time/time.h
index 2cf89e6222..d18089116e 100644
--- a/time/time.h
+++ b/time/time.h
@@ -240,21 +240,30 @@ extern long int timezone;
   ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
 
 
+#if defined __USE_MISC || __GLIBC_USE (ISOC2X)
+# ifndef __USE_TIME_BITS64
+/* Like `mktime', but for TP represents Universal Time, not local time.  */
+extern time_t timegm (struct tm *__tp) __THROW;
+# else
+#  ifdef __REDIRECT_NTH
+extern time_t __REDIRECT_NTH (timegm, (struct tm *__tp), __timegm64);
+#  else
+#   define timegm __timegm64
+#  endif
+# endif
+#endif
+
+
 #ifdef __USE_MISC
 /* Miscellaneous functions many Unices inherited from the public domain
    localtime package.  These are included only for compatibility.  */
 
 #ifndef __USE_TIME_BITS64
-/* Like `mktime', but for TP represents Universal Time, not local time.  */
-extern time_t timegm (struct tm *__tp) __THROW;
 /* Another name for `mktime'.  */
 extern time_t timelocal (struct tm *__tp) __THROW;
 #else
 # ifdef __REDIRECT_NTH
-extern time_t __REDIRECT_NTH (timegm, (struct tm *__tp), __timegm64);
 extern time_t __REDIRECT_NTH (timelocal, (struct tm *__tp), __mktime64);
-# else
-#  define timegm __timegm64
 # endif
 #endif
 

-- 
Joseph S. Myers
joseph@codesourcery.com

             reply	other threads:[~2022-06-01 23:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01 23:08 Joseph Myers [this message]
2022-06-02  9:53 ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.22.394.2206012307340.3755786@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).