Browse Source

archive creation start/end timestamp: use utc

the timestamp given via cli is already expected to be utc.

the timestamp which is automatically created when no cli timestamp is given is also utc.

thus, also use utc for .start and .end.
Thomas Waldmann 9 years ago
parent
commit
a078d730e1
2 changed files with 3 additions and 3 deletions
  1. 1 1
      borg/archive.py
  2. 2 2
      borg/archiver.py

+ 1 - 1
borg/archive.py

@@ -128,7 +128,7 @@ class Archive:
     def __init__(self, repository, key, manifest, name, cache=None, create=False,
     def __init__(self, repository, key, manifest, name, cache=None, create=False,
                  checkpoint_interval=300, numeric_owner=False, progress=False,
                  checkpoint_interval=300, numeric_owner=False, progress=False,
                  chunker_params=CHUNKER_PARAMS,
                  chunker_params=CHUNKER_PARAMS,
-                 start=datetime.now(), end=datetime.now()):
+                 start=datetime.utcnow(), end=datetime.utcnow()):
         self.cwd = os.getcwd()
         self.cwd = os.getcwd()
         self.key = key
         self.key = key
         self.repository = repository
         self.repository = repository

+ 2 - 2
borg/archiver.py

@@ -191,7 +191,7 @@ class Archiver:
                 if args.progress:
                 if args.progress:
                     archive.stats.show_progress(final=True)
                     archive.stats.show_progress(final=True)
                 if args.stats:
                 if args.stats:
-                    archive.end = datetime.now()
+                    archive.end = datetime.utcnow()
                     log_multi(DASHES,
                     log_multi(DASHES,
                               str(archive),
                               str(archive),
                               DASHES,
                               DASHES,
@@ -202,7 +202,7 @@ class Archiver:
         self.output_filter = args.output_filter
         self.output_filter = args.output_filter
         self.output_list = args.output_list
         self.output_list = args.output_list
         dry_run = args.dry_run
         dry_run = args.dry_run
-        t0 = datetime.now()
+        t0 = datetime.utcnow()
         if not dry_run:
         if not dry_run:
             repository = self.open_repository(args, exclusive=True)
             repository = self.open_repository(args, exclusive=True)
             manifest, key = Manifest.load(repository)
             manifest, key = Manifest.load(repository)