diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-10-02 22:43:00 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-10-02 22:43:00 +0200 |
commit | 215651cbb391b4021fb39935a32ba1850db189d8 (patch) | |
tree | a3de026d20536c12348f90f6e2c41406344e1024 /src | |
parent | Merge pull request #4490 (diff) | |
parent | daemon: do not display uptime when not known (diff) | |
download | monero-215651cbb391b4021fb39935a32ba1850db189d8.tar.xz |
Merge pull request #4485
5ec929fb daemon: do not display uptime when not known (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r-- | src/daemon/rpc_command_executor.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp index 6b6c88907..6464d372f 100644 --- a/src/daemon/rpc_command_executor.cpp +++ b/src/daemon/rpc_command_executor.cpp @@ -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) @@ -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; } |