improve formating of hash rate

This commit is contained in:
moneroexamples 2018-07-07 08:41:40 +08:00
parent cfcef1d749
commit 7bb80afea8
1 changed files with 5 additions and 7 deletions

View File

@ -881,14 +881,12 @@ public:
// perapre network info mstch::map for the front page
string hash_rate;
if (testnet || stagenet)
{
hash_rate = std::to_string(current_network_info.hash_rate) + " H/s";
}
else
{
if (current_network_info.hash_rate > 1e6)
hash_rate = fmt::format("{:0.3f} MH/s", current_network_info.hash_rate/1.0e6);
}
else if (current_network_info.hash_rate > 1e3)
hash_rate = fmt::format("{:0.3f} kH/s", current_network_info.hash_rate/1.0e3);
else
hash_rate = fmt::format("{:0.3f} H/s", current_network_info.hash_rate);
pair<string, string> network_info_age = get_age(local_copy_server_timestamp,
current_network_info.info_timestamp);