From 47380f67e9e21114020937c5afdb81c5c83f4fcd Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Fri, 3 Mar 2017 23:50:12 -0700 Subject: [PATCH] LU-7567 utils: fix timestamp printing in lfs_changelog() lfs_changelog() should use ".09d" when printing the fractional part instead of ".06d" for accurate timestamps. Test-Parameters: trivial Signed-off-by: akam kumar bharathi Signed-off-by: Andreas Dilger Change-Id: I2b219f588de688ba06b3c8cf3ccd255ed845c45e Reviewed-on: https://review.whamcloud.com/18006 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Faccini Bruno Reviewed-by: Oleg Drokin --- lustre/utils/lfs.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 7406999..c9b10e8 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -4317,26 +4317,26 @@ static int lfs_changelog(int argc, char **argv) return rc; } - while ((rc = llapi_changelog_recv(changelog_priv, &rec)) == 0) { - time_t secs; - struct tm ts; + while ((rc = llapi_changelog_recv(changelog_priv, &rec)) == 0) { + time_t secs; + struct tm ts; - if (endrec && rec->cr_index > endrec) { - llapi_changelog_free(&rec); - break; - } - if (rec->cr_index < startrec) { - llapi_changelog_free(&rec); - continue; - } + if (endrec && rec->cr_index > endrec) { + llapi_changelog_free(&rec); + break; + } + if (rec->cr_index < startrec) { + llapi_changelog_free(&rec); + continue; + } secs = rec->cr_time >> 30; gmtime_r(&secs, &ts); - printf("%ju %02d%-5s %02d:%02d:%02d.%06d %04d.%02d.%02d " - "0x%x t="DFID, (uintmax_t) rec->cr_index, rec->cr_type, + printf("%ju %02d%-5s %02d:%02d:%02d.%09d %04d.%02d.%02d " + "0x%x t="DFID, (uintmax_t)rec->cr_index, rec->cr_type, changelog_type2str(rec->cr_type), ts.tm_hour, ts.tm_min, ts.tm_sec, - (int)(rec->cr_time & ((1<<30) - 1)), + (int)(rec->cr_time & ((1 << 30) - 1)), ts.tm_year + 1900, ts.tm_mon + 1, ts.tm_mday, rec->cr_flags & CLF_FLAGMASK, PFID(&rec->cr_tfid)); -- 1.8.3.1