From 9289f4be460e910189f553fe2b63e6e3aabe5b27 Mon Sep 17 00:00:00 2001 From: Varun Shastry Date: Mon, 10 Sep 2012 11:08:01 +0530 Subject: CLI: Displaying time as N/A when unix time is 0 Problem: 'volume top open' command was displaying '1970-01-01 00:00:00.000000' when no file has opened yet. Fix: Made the fix in gf_time_fmt() to make it more generic according to patchset 1 review comment. Change-Id: I748ed203bd0d9fbaac94b5b51ed708b34fccd434 BUG: 852000 Signed-off-by: Varun Shastry Reviewed-on: http://review.gluster.org/3924 Tested-by: Gluster Build System Reviewed-by: Kaleb KEITHLEY Reviewed-by: Kaushal M Reviewed-by: Vijay Bellur --- libglusterfs/src/common-utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 7e9145717..5968cd060 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -449,10 +449,10 @@ gf_time_fmt (char *dst, size_t sz_dst, time_t utime, unsigned int fmt) if (timefmt_last == -1) _gf_timestuff (&timefmt_last, &fmts, &zeros); if (timefmt_last < fmt) fmt = gf_timefmt_default; - if (gmtime_r (&utime, &tm) != NULL) { + if (utime && gmtime_r (&utime, &tm) != NULL) { strftime (dst, sz_dst, fmts[fmt], &tm); } else { - strncpy (dst, zeros[fmt], sz_dst); + strncpy (dst, "N/A", sz_dst); } } -- cgit