Skip to content
Snippets Groups Projects
Commit 98481ec4 authored by Luke Howard's avatar Luke Howard
Browse files

Use gmtime_r() if HAVE_GMTIME_R is defined (need to add autoconf check)

parent 399b57ea
Branches
Tags
No related merge requests found
......@@ -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, &ltm_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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment