summaryrefslogtreecommitdiff
path: root/rdiff-backup/rdiff_backup/Main.py
diff options
context:
space:
mode:
authorowsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2009-01-03 21:35:59 +0000
committerowsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2009-01-03 21:35:59 +0000
commit7eba4b4cdd8530530b8708947cf7a2799f7cb55d (patch)
treeea6a763257ca75d1f91af06620ec75153df4d671 /rdiff-backup/rdiff_backup/Main.py
parente389196e3426dde8957d38b4da8135489f80ae6a (diff)
downloadrdiff-backup-7eba4b4cdd8530530b8708947cf7a2799f7cb55d.tar.gz
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
Diffstat (limited to 'rdiff-backup/rdiff_backup/Main.py')
-rw-r--r--rdiff-backup/rdiff_backup/Main.py16
1 files changed, 15 insertions, 1 deletions
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