updated usage of time.time to time.monotonic or time.perf_counter due to time.time possibly rolling backwards

This commit is contained in:
Blake Harnden 2019-12-06 09:42:41 -08:00
parent b9bbf397c9
commit 45a23a6c14
11 changed files with 29 additions and 29 deletions

View file

@ -411,7 +411,7 @@ class CoreClient:
else:
emane_config = None
start = time.time()
start = time.perf_counter()
response = self.client.start_session(
self.session_id,
nodes,
@ -425,7 +425,7 @@ class CoreClient:
service_configs,
file_configs,
)
process_time = time.time() - start
process_time = time.perf_counter() - start
logging.debug("start session(%s), result: %s", self.session_id, response.result)
self.app.statusbar.start_session_callback(process_time)
@ -439,9 +439,9 @@ class CoreClient:
def stop_session(self, session_id=None):
if not session_id:
session_id = self.session_id
start = time.time()
start = time.perf_counter()
response = self.client.stop_session(session_id)
process_time = time.time() - start
process_time = time.perf_counter() - start
self.app.statusbar.stop_session_callback(process_time)
logging.debug("stopped session(%s), result: %s", session_id, response.result)

View file

@ -33,10 +33,10 @@ class MenuAction:
def cleanup_old_session(self, quitapp=False):
logging.info("cleaning up old session")
start = time.time()
start = time.perf_counter()
self.app.core.stop_session()
self.app.core.delete_session()
process_time = time.time() - start
process_time = time.perf_counter() - start
self.app.statusbar.stop_session_callback(process_time)
if quitapp:
self.app.quit()