]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Also undefine gmtime.
authorJim Meyering <jim@meyering.net>
Mon, 9 Jun 2003 20:53:15 +0000 (20:53 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 9 Jun 2003 20:53:15 +0000 (20:53 +0000)
(rpl_gmtime): New function.  Suggestion from Paul Eggert.

lib/gettimeofday.c

index 909e6eb25a95af3c663b33a18ada6582fa77d754..1ebe4d0ffddd150158a63af70b38834ef2cfe3f0 100644 (file)
@@ -25,6 +25,7 @@
 /* Disable the definitions of these functions (from config.h)
    so we can use the library versions here.  */
 #undef gettimeofday
+#undef gmtime
 #undef localtime
 #undef tzset
 
@@ -62,6 +63,18 @@ rpl_localtime (const time_t *timep)
   return tm;
 }
 
+/* Same as above, since gmtime and localtime use the same buffer.  */
+struct tm *
+rpl_gmtime (const time_t *timep)
+{
+  struct tm *tm = gmtime (timep);
+
+  if (! localtime_buffer_addr)
+    localtime_buffer_addr = tm;
+
+  return tm;
+}
+
 /* This is a wrapper for gettimeofday.  It is used only on systems for which
    gettimeofday clobbers the static buffer used for localtime's result.