public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Declare timegm for ISO C2X
@ 2022-06-01 23:08 Joseph Myers
  2022-06-02  9:53 ` Andreas Schwab
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Myers @ 2022-06-01 23:08 UTC (permalink / raw)
  To: libc-alpha

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Declare timegm for ISO C2X
  2022-06-01 23:08 Declare timegm for ISO C2X Joseph Myers
@ 2022-06-02  9:53 ` Andreas Schwab
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Schwab @ 2022-06-02  9:53 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha

On Jun 01 2022, Joseph Myers wrote:

> 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.

Ok.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-02  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 23:08 Declare timegm for ISO C2X Joseph Myers
2022-06-02  9:53 ` Andreas Schwab

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).