From: Andre Noll Date: Sun, 15 Oct 2017 19:11:46 +0000 (+0200) Subject: ls: Print current duration of incomplete snapshots. X-Git-Tag: v1.0.0~9^2 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=dfe40aec1c2e651fdb3b62b0bcae52a5dfb1aa8d;p=dss.git ls: Print current duration of incomplete snapshots. Currently the duration of incomplete (and orphaned) snapshots is shown as 0:00. It's more interesting to see for how long the snapshot is already being created, so print the difference of the current time and the start time instead. Fix an overlong line and a whitespace issue while at it. --- diff --git a/dss.c b/dss.c index 3e626ab..122472e 100644 --- a/dss.c +++ b/dss.c @@ -1683,13 +1683,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;