]> git.tuebingen.mpg.de Git - dss.git/commitdiff
Merge branch 'refs/heads/t/ls-incomplete-duration'
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 16 Nov 2017 19:57:34 +0000 (20:57 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 16 Nov 2017 20:02:19 +0000 (21:02 +0100)
A simple patch which improves the ls output.

Cooking for 10 days.

* refs/heads/t/ls-incomplete-duration:
  ls: Print current duration of incomplete snapshots.

NEWS
dss.c

diff --git a/NEWS b/NEWS
index 75fe3a2bd5eda8353f9bb4f42b9e62fcbf6e5ff7..f103fb497b6ae944827b71827f74a725b6fe2693 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,14 +1,10 @@
 -----------------------
-x.y.z (to be announced)
+1.0.0 (to be announced)
 -----------------------
 
- - Improved error diagnostics for the kill subcommand.
-
- - The --no-resume option has been removed.
-
  - The gengetopt option parser has been replaced by the
  [lopsub](http://people.tuebingen.mpg.de/maan/lopsub) library. Hence
- lopsub must be installed to compile this package. Also help2man is
+ lopsub must be installed to compile this package. help2man is
  no longer required since lopsub has built-in roff support.
 
  - New subcommand "configtest" to check the command line options and
@@ -17,19 +13,26 @@ x.y.z (to be announced)
  - New option: --mountpoint. If this option is given, dss aborts if
  no file system is mounted on the destination directory.
 
- - "make install" will install the executable and the man page.
+ - The --no-resume option has been removed.
+
+ - The ls subcommand now shows the age of incomplete snapshots rather
+ than 0:00.
+
+ - New option --checksum to let rsync compute checksums occasionally.
 
  - In run mode, dss no longer exits successfully if another instance
  is already running.
 
- - New option --checksum to let rsync compute checksums occasionally.
+ - "make install" will install the executable and the man page.
 
- - CFLAGS, CPPFLAGS and LDFLAGS can now be used to override the flags
- of the build system.
+ - Improved error diagnostics for the kill subcommand.
 
  - For all subcommands other than "run", timestamps and function names
  are omitted from the log output.
 
+ - CFLAGS, CPPFLAGS and LDFLAGS can now be used to override the flags
+ of the build system.
+
  - The dss logo is now created with ImageMagick rather than dia.
 
 ------------------
diff --git a/dss.c b/dss.c
index bd9e577e3f6a6df2b94c6f48dddb9ffdeff96d39..24d77eb79dbd2ab0862b2b7012b73babde542c93 100644 (file)
--- a/dss.c
+++ b/dss.c
@@ -1709,13 +1709,17 @@ static int com_ls(void)
        int i;
        struct snapshot_list sl;
        struct snapshot *s;
+       int64_t now = get_current_time();
 
        dss_get_snapshot_list(&sl);
        FOR_EACH_SNAPSHOT(s, i, &sl) {
-               int64_t d = 0;
+               int64_t d;
                if (s->flags & SS_COMPLETE)
                        d = (s->completion_time - s->creation_time) / 60;
-               dss_msg("%u\t%s\t%3" PRId64 ":%02" PRId64 "\n", s->interval, s->name, d/60, d%60);
+               else
+                       d = (now - s->creation_time) / 60;
+               dss_msg("%u\t%s\t%3" PRId64 ":%02" PRId64 "\n", s->interval,
+                       s->name, d / 60, d % 60);
        }
        free_snapshot_list(&sl);
        return 1;