From: Andreas Dilger Date: Sat, 4 Mar 2017 06:50:12 +0000 (-0700) Subject: LU-7567 utils: fix timestamp printing in lfs_changelog() X-Git-Tag: 2.9.58~44 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F06%2F18006%2F5;p=fs%2Flustre-release.git 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 --- 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));