diff --git a/src/commands/balance.rs b/src/commands/balance.rs index 9e85a5e12e50ddc8746a4d446efc49017101b5c0..b19366361e443e7bd907c1fb1ea79ef065e71f60 100644 --- a/src/commands/balance.rs +++ b/src/commands/balance.rs @@ -23,11 +23,18 @@ pub(crate) fn balance<W: Write>( ud_unit: bool, ) -> anyhow::Result<()> { let pubkey_or_script = PubkeyOrScript::from_str(pubkey_or_script)?; + + let req_time = Instant::now(); if let Some(AccountBalance { amount, ud_amount_opt, }) = requestor.account_balance(gva_endpoint, &pubkey_or_script, ud_unit)? { + println!( + "The server responded in {} ms.", + req_time.elapsed().as_millis() + ); + if let Some(ud_amount) = ud_amount_opt { writeln!( out, diff --git a/src/commands/current_ud.rs b/src/commands/current_ud.rs index c29a25b0fd2b696f9c74790e70369ec214b94b31..72bab5368ae5552a0b98b5ce95c10bf85a5aaa00 100644 --- a/src/commands/current_ud.rs +++ b/src/commands/current_ud.rs @@ -20,7 +20,13 @@ pub(crate) fn current_ud<W: Write>( out: &mut W, requestor: &GvaRequestor, ) -> anyhow::Result<()> { + let req_time = Instant::now(); if let Some(current_ud) = requestor.current_ud(gva_endpoint)? { + println!( + "The server responded in {} ms.", + req_time.elapsed().as_millis() + ); + let int_part = current_ud / 100; let dec_part = current_ud % 100; writeln!( diff --git a/src/commands/idty.rs b/src/commands/idty.rs index ebe1fcb9b5d5e80924186a871f2eaf3f9afef159..10414eccdcad3013f2716304cea7ce4dad6ca880 100644 --- a/src/commands/idty.rs +++ b/src/commands/idty.rs @@ -22,12 +22,19 @@ pub(crate) fn idty<W: Write>( requestor: &GvaRequestor, ) -> anyhow::Result<()> { let pubkey = PublicKey::from_base58(pubkey)?; + + let req_time = Instant::now(); if let Some(Idty { is_member, username, .. }) = requestor.idty_by_pubkey(gva_endpoint, pubkey)? { + println!( + "The server responded in {} ms.", + req_time.elapsed().as_millis() + ); + writeln!(out, "Found identity for pubkey:")?; writeln!(out, "username: {}", username)?; writeln!(out, "is_member: {}", is_member)?; diff --git a/src/commands/members_count.rs b/src/commands/members_count.rs index bcc8017d1afcf986a61ac2810b506571ca3338ca..c4f5620e1a05bb18fac913c9db06a376a6a85e25 100644 --- a/src/commands/members_count.rs +++ b/src/commands/members_count.rs @@ -20,7 +20,12 @@ pub(crate) fn members_count<W: Write>( out: &mut W, requestor: &GvaRequestor, ) -> anyhow::Result<()> { + let req_time = Instant::now(); let members_count = requestor.members_count(gva_endpoint)?; + println!( + "The server responded in {} ms.", + req_time.elapsed().as_millis() + ); writeln!( out, diff --git a/src/main.rs b/src/main.rs index 67821f8a5f13da3e40f3153a0cc4221bb5eef990..2aa77ca4f7bd9ced0835476859cd1dbf0215e858 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,6 +46,7 @@ use std::{ io::{BufReader, Read, Write}, path::PathBuf, str::FromStr, + time::Instant, }; use structopt::StructOpt;