+/* This is a wrapper for localtime. It is used only on systems for which
+ gettimeofday clobbers the static buffer used for localtime's result.
+
+ On the first call, record the address of the static buffer that
+ localtime uses for its result. */
+
+struct tm *
+rpl_localtime (const time_t *timep)
+{
+ struct tm *tm = localtime (timep);
+
+ if (! localtime_buffer_addr)
+ localtime_buffer_addr = tm;
+
+ 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;
+}
+