From: Stefan Huber Date: Thu, 17 May 2012 07:38:44 +0000 (+0200) Subject: print age of backups X-Git-Tag: v1.0~3 X-Git-Url: https://git.sthu.org/?p=sitarba.git;a=commitdiff_plain;h=8a63842725558d8877a933bbd1f5312bb8e6f195;hp=570c75b02f2ed72f43e1cb5246f497165fe2aff6 print age of backups --- diff --git a/shbackup b/shbackup index a45305e..0cfc4c7 100755 --- 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):