From 98481ec4499d3ed5cbb9a39472ae5deead46089e Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Sat, 6 Dec 2003 05:48:29 +0000 Subject: [PATCH] Use gmtime_r() if HAVE_GMTIME_R is defined (need to add autoconf check) --- libraries/liblutil/csn.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/liblutil/csn.c b/libraries/liblutil/csn.c index 62247fd098..462efbbcff 100644 --- a/libraries/liblutil/csn.c +++ b/libraries/liblutil/csn.c @@ -57,6 +57,9 @@ lutil_csnstr(char *buf, size_t len, unsigned int replica, unsigned int mod) time_t t; unsigned int op; struct tm *ltm; +#ifdef HAVE_GMTIME_R + struct tm ltm_buf; +#endif int n; time( &t ); @@ -66,7 +69,11 @@ lutil_csnstr(char *buf, size_t len, unsigned int replica, unsigned int mod) } op = ++csnop; +#ifdef HAVE_GMTIME_R + ltm = gmtime_r( &t, <m_buf ); +#else ltm = gmtime( &t ); +#endif n = snprintf( buf, len, "%4d%02d%02d%02d%02d%02dZ#%06x#%02x#%06x", ltm->tm_year + 1900, ltm->tm_mon + 1, ltm->tm_mday, ltm->tm_hour, -- 2.39.5