- tm_now = localtime (&now);
- strftime (tempbuf, BUFFER_SIZE-6, "%b %d %H:%M:%S ", tm_now);
+#ifdef HAVE_LOCALTIME_R
+ tm_now = *localtime_r(&now, &tm_now);
+#else
+ tm_now = *localtime (&now);
+#endif
+ strftime(tempbuf, BUFFER_SIZE-6, "%b %d %H:%M:%S ", &tm_now);