diff options
Diffstat (limited to 'libglusterfs/src/common-utils.h')
-rw-r--r-- | libglusterfs/src/common-utils.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 799a356d8a5..4470bb25f25 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -687,12 +687,15 @@ gf_time_fmt (char *dst, size_t sz_dst, time_t utime, unsigned int fmt) static gf_timefmts timefmt_last = (gf_timefmts) - 1; static const char **fmts; static const char **zeros; - struct tm tm; + struct tm tm, *res; + int localtime = 0; if (timefmt_last == (gf_timefmts) - 1) _gf_timestuff (&timefmt_last, &fmts, &zeros); if (timefmt_last < fmt) fmt = gf_timefmt_default; - if (utime && gmtime_r (&utime, &tm) != NULL) { + localtime = gf_log_get_localtime (); + res = localtime ? localtime_r (&utime, &tm) : gmtime_r (&utime, &tm); + if (utime && res != NULL) { strftime (dst, sz_dst, fmts[fmt], &tm); } else { strncpy (dst, "N/A", sz_dst); |