From: Alberto Berti Date: Tue, 24 Feb 2009 18:14:25 +0000 (-0700) Subject: Add elapsed timestamp to cli backup command final summary. X-Git-Url: https://git.rkrishnan.org/pf/content/%22file:?a=commitdiff_plain;h=7e8958671b2e07f422226fe685f32e5ba38dedae;p=tahoe-lafs%2Ftahoe-lafs.git Add elapsed timestamp to cli backup command final summary. --- diff --git a/src/allmydata/scripts/tahoe_backup.py b/src/allmydata/scripts/tahoe_backup.py index f75aafaf..b0e51d69 100644 --- a/src/allmydata/scripts/tahoe_backup.py +++ b/src/allmydata/scripts/tahoe_backup.py @@ -3,6 +3,7 @@ import os.path import time import urllib import simplejson +import datetime from allmydata.scripts.common import get_alias, escape_path, DEFAULT_ALIAS from allmydata.scripts.common_http import do_http from allmydata import uri @@ -144,6 +145,7 @@ class BackerUpper: stdout = options.stdout stderr = options.stderr + start_timestamp = datetime.datetime.now() self.backupdb = None use_backupdb = not options["no-backupdb"] if use_backupdb: @@ -209,6 +211,9 @@ class BackerUpper: put_child(archives_url, now, new_readonly_backup_dircap) put_child(to_url, "Latest", new_readonly_backup_dircap) + end_timestamp = datetime.datetime.now() + # calc elapsed time, omitting microseconds + elapsed_time = str(end_timestamp - start_timestamp).split('.')[0] if self.verbosity >= 1: print >>stdout, (" %d files uploaded (%d reused), " @@ -223,7 +228,7 @@ class BackerUpper: % (self.files_checked, self.directories_checked, self.directories_read)) - print >>stdout, " backup done" + print >>stdout, " backup done, elapsed time: %s" % elapsed_time # done! return 0