diff options
author | Varun Shastry <vshastry@redhat.com> | 2012-09-10 11:08:01 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-09-17 22:35:58 -0700 |
commit | 9289f4be460e910189f553fe2b63e6e3aabe5b27 (patch) | |
tree | 08d21e2974d00bd7f33f85479c427721f396d465 /xlators/debug/io-stats | |
parent | f7342ad3a91ac5140e9c24e20007519847f4f4ec (diff) |
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 <vshastry@redhat.com>
Reviewed-on: http://review.gluster.org/3924
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/debug/io-stats')
-rw-r--r-- | xlators/debug/io-stats/src/io-stats.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 912c78e69c4..556c7224960 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -1087,9 +1087,10 @@ io_stats_dump_stats_to_dict (xlator_t *this, dict_t *resp, gf_time_fmt (timestr, sizeof timestr, conf->cumulative.max_openfd_time.tv_sec, gf_timefmt_FT); - snprintf (timestr + strlen (timestr), sizeof timestr - strlen (timestr), - ".%"GF_PRI_SUSECONDS, - conf->cumulative.max_openfd_time.tv_usec); + if (conf->cumulative.max_openfd_time.tv_sec) + snprintf (timestr + strlen (timestr), sizeof timestr - strlen (timestr), + ".%"GF_PRI_SUSECONDS, + conf->cumulative.max_openfd_time.tv_usec); dict_timestr = gf_strdup (timestr); if (!dict_timestr) |