Skip to content

Commit

Permalink
Merge pull request monero-project#4485
Browse files Browse the repository at this point in the history
5ec929f daemon: do not display uptime when not known (moneromooo-monero)
  • Loading branch information
fluffypony authored and Mykola Misiura committed May 1, 2019
1 parent e7bff66 commit 16519f9
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/daemon/rpc_command_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,8 @@ bool t_rpc_command_executor::show_status() {
}
}

tools::success_msg_writer() << boost::format("Height: %llu/%llu (%.1f%%) on %s%s, %s, net hash %s, v%u%s, %s, %u(out)+%u(in) connections, uptime %ud %uh %um %us")
std::stringstream str;
str << boost::format("Height: %llu/%llu (%.1f%%) on %s%s, %s, net hash %s, v%u%s, %s, %u(out)+%u(in) connections")
% (unsigned long long)ires.height
% (unsigned long long)net_height
% get_sync_percentage(ires)
Expand All @@ -455,12 +456,21 @@ bool t_rpc_command_executor::show_status() {
% (hfres.state == cryptonote::HardFork::Ready ? "up to date" : hfres.state == cryptonote::HardFork::UpdateNeeded ? "update needed" : "out of date, likely forked")
% (unsigned)ires.outgoing_connections_count
% (unsigned)ires.incoming_connections_count
% (unsigned int)floor(uptime / 60.0 / 60.0 / 24.0)
% (unsigned int)floor(fmod((uptime / 60.0 / 60.0), 24.0))
% (unsigned int)floor(fmod((uptime / 60.0), 60.0))
% (unsigned int)fmod(uptime, 60.0)
;

// restricted RPC does not disclose start time
if (ires.start_time)
{
str << boost::format(", uptime %ud %uh %um %us")
% (unsigned int)floor(uptime / 60.0 / 60.0 / 24.0)
% (unsigned int)floor(fmod((uptime / 60.0 / 60.0), 24.0))
% (unsigned int)floor(fmod((uptime / 60.0), 60.0))
% (unsigned int)fmod(uptime, 60.0)
;
}

tools::success_msg_writer() << str.str();

return true;
}

Expand Down

0 comments on commit 16519f9

Please sign in to comment.