print age of backups
[sitarba.git] / shbackup
index a45305e59ae8e9f1f88f28126065bfd457618c8c..0cfc4c74f3a03f5a0d2c846ef7c191f11600770f 100755 (executable)
--- a/shbackup
+++ b/shbackup
@@ -57,8 +57,14 @@ class Backup:
                 ", mode: " + self.mode + "]"
 
     def colAlignedString(self):
-        return "%16s    %8s    %4s" % ( \
-                self.date.strftime("%Y-%m-%d %H:%M"), self.epoch, self.mode)
+        age = datetime.datetime.now() - self.date
+        total_hours = age.total_seconds()/3600
+        if total_hours <= 48:
+            agestr = "(%s h)" % int(total_hours)
+        else:
+            agestr = "(%s d)" % age.days
+        return "%16s  %7s  %8s  %4s" % ( \
+                self.date.strftime("%Y-%m-%d %H:%M"), agestr, self.epoch, self.mode)
 
     @staticmethod
     def getDirName(date, epoch, mode):