From de678f93215bc49fad32b742e7fe3cb870151d89 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 9 Jun 2003 20:53:15 +0000 Subject: [PATCH] Also undefine gmtime. (rpl_gmtime): New function. Suggestion from Paul Eggert. --- lib/gettimeofday.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c index 909e6eb25a..1ebe4d0ffd 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. -- 2.47.2