summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-06-09 20:53:15 +0000
committerJim Meyering <jim@meyering.net>2003-06-09 20:53:15 +0000
commitde678f93215bc49fad32b742e7fe3cb870151d89 (patch)
treef10c2887bf618d2ab8dca7256113b73f59c02b25
parent633fbb7c66c5fa9edf010e55bec1b48c1fb02c6f (diff)
downloadcoreutils-de678f93215bc49fad32b742e7fe3cb870151d89.tar.xz
Also undefine gmtime.
(rpl_gmtime): New function. Suggestion from Paul Eggert.
-rw-r--r--lib/gettimeofday.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c
index 909e6eb25..1ebe4d0ff 100644
--- a/lib/gettimeofday.c
+++ b/lib/gettimeofday.c
@@ -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.