From 67b0b19bca78fb5ee102e9405d583954d5f11bf5 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 17 Oct 2023 12:39:37 -0400 Subject: [PATCH] Use better time functionality --- daemon-common/vm.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/daemon-common/vm.py b/daemon-common/vm.py index 4eb6f489..ad364abe 100644 --- a/daemon-common/vm.py +++ b/daemon-common/vm.py @@ -1308,7 +1308,7 @@ def backup_vm( zkhandler, domain, target_path, incremental_parent=None, retain_snapshots=False ): - tstart = datetime.now() + tstart = time.time() # 0. Validations # Validate that VM exists in cluster @@ -1454,8 +1454,8 @@ def backup_vm( which_snapshot_remove_failed.append(f"{pool}/{volume}") msg_snapshot_remove_failed.append(retmsg) - tend = datetime.now() - ttot = (tend - tstart).total_seconds() + tend = time.time() + ttot = round(tend - tstart, 2) if is_snapshot_remove_failed: return ( @@ -1465,5 +1465,5 @@ def backup_vm( return ( True, - f"Successfully backed up VM {domain} ({backup_type} @ {datestring}) to {target_path} in {ttot} seconds", + f"Successfully backed up VM {domain} ({backup_type} @ {datestring}) to {target_path} in {ttot} seconds.", )