From 2688f233b84e4b892c05e5fcac4c6bfa9d1d14fb Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Sat, 17 Apr 2021 23:49:53 +0200 Subject: [PATCH] add timeinfo for 'listmsgs' repl command --- examples/repl/cmdline.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/repl/cmdline.rs b/examples/repl/cmdline.rs index 61e289b44..1f4fa5fb9 100644 --- a/examples/repl/cmdline.rs +++ b/examples/repl/cmdline.rs @@ -525,9 +525,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu None, ) .await?; - let time_needed = std::time::SystemTime::now() - .duration_since(time_start) - .unwrap_or_default(); + let time_needed = time_start.elapsed().unwrap_or_default(); let cnt = chatlist.len(); if cnt > 0 { @@ -898,10 +896,13 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu None }; + let time_start = std::time::SystemTime::now(); let msglist = context.search_msgs(chat, arg1).await?; + let time_needed = time_start.elapsed().unwrap_or_default(); log_msglist(&context, &msglist).await?; println!("{} messages.", msglist.len()); + println!("{:?} to create this list", time_needed); } "draft" => { ensure!(sel_chat.is_some(), "No chat selected.");