From 7eba4b4cdd8530530b8708947cf7a2799f7cb55d Mon Sep 17 00:00:00 2001 From: owsla Date: Sat, 3 Jan 2009 21:35:59 +0000 Subject: Take start and end times from same system so that the elapsed time printed in the statistics is not affected by time zone. git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@994 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/rdiff_backup/Main.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'rdiff-backup/rdiff_backup/Main.py') diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py index 47246f6..7283bfb 100644 --- a/rdiff-backup/rdiff_backup/Main.py +++ b/rdiff-backup/rdiff_backup/Main.py @@ -20,7 +20,7 @@ """Start (and end) here - read arguments, set global settings, etc.""" from __future__ import generators -import getopt, sys, re, os, cStringIO, tempfile +import getopt, sys, re, os, cStringIO, tempfile, time from log import Log, LoggerError, ErrorLog import Globals, Time, SetConnections, selection, robust, rpath, \ manage, backup, connection, restore, FilenameMapping, \ @@ -345,6 +345,7 @@ def Backup(rpin, rpout): else: backup.Mirror(rpin, rpout) rpout.conn.Main.backup_touch_curmirror_local(rpin, rpout) + rpout.conn.Main.backup_close_statistics(time.time()) def backup_quoted_rpaths(rpout): """Get QuotedRPath versions of important RPaths. Return rpout""" @@ -534,6 +535,19 @@ def backup_remove_curmirror_local(): C.sync() # Make sure everything is written before curmirror is removed older_inc.delete() +def backup_close_statistics(end_time): + """Close out the tracking of the backup statistics. + + Moved to run at this point so that only the clock of the system on which + rdiff-backup is run is used (set by passing in time.time() from that + system). Use at end of session. + + """ + assert Globals.rbdir.conn is Globals.local_connection + if Globals.print_statistics: statistics.print_active_stats(end_time) + if Globals.file_statistics: statistics.FileStats.close() + statistics.write_active_statfileobj(end_time) + def Restore(src_rp, dest_rp, restore_as_of = None): """Main restoring function -- cgit v1.2.1