Whamcloud - gitweb
LU-7567 utils: fix timestamp printing in lfs_changelog() 06/18006/5
authorAndreas Dilger <andreas.dilger@intel.com>
Sat, 4 Mar 2017 06:50:12 +0000 (23:50 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 12 May 2017 05:06:37 +0000 (05:06 +0000)
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 <azurelustre@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I2b219f588de688ba06b3c8cf3ccd255ed845c45e
Reviewed-on: https://review.whamcloud.com/18006
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Faccini Bruno <bruno.faccini@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/utils/lfs.c

index 7406999..c9b10e8 100644 (file)
@@ -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));