aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/rpc_command_executor.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-01-13 14:35:21 -0500
committerRiccardo Spagni <ric@spagni.net>2017-01-13 14:35:21 -0500
commit0b6031adbfdfe570a1985ae0eabbc056a5545a84 (patch)
tree78776d0da0587f2127e5e52f2214c1c57b6628d5 /src/daemon/rpc_command_executor.cpp
parentMerge pull request #1541 (diff)
parentAdd start_time to get_info methods and show uptime (diff)
downloadmonero-0b6031adbfdfe570a1985ae0eabbc056a5545a84.tar.xz
Merge pull request #1543
19be7225 Add start_time to get_info methods and show uptime (Miguel Herranz)
Diffstat (limited to 'src/daemon/rpc_command_executor.cpp')
-rw-r--r--src/daemon/rpc_command_executor.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp
index 4d415b4c2..447783d76 100644
--- a/src/daemon/rpc_command_executor.cpp
+++ b/src/daemon/rpc_command_executor.cpp
@@ -363,7 +363,9 @@ bool t_rpc_command_executor::show_status() {
}
}
- tools::success_msg_writer() << boost::format("Height: %llu/%llu (%.1f%%) on %s, %s, net hash %s, v%u%s, %s, %u+%u connections")
+ std::time_t uptime = std::time(nullptr) - ires.start_time;
+
+ tools::success_msg_writer() << boost::format("Height: %llu/%llu (%.1f%%) on %s, %s, net hash %s, v%u%s, %s, %u+%u connections, uptime %uh %um %us")
% (unsigned long long)ires.height
% (unsigned long long)(ires.target_height >= ires.height ? ires.target_height : ires.height)
% get_sync_percentage(ires)
@@ -374,6 +376,9 @@ bool t_rpc_command_executor::show_status() {
% get_fork_extra_info(hfres.earliest_height, ires.height, ires.target)
% (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 / 3600.0)
+ % (unsigned int)floor(fmod(uptime, 3600.0) / 60.0)
+ % (unsigned int)fmod(uptime, 60.0)
;
return true;