diff options
Diffstat (limited to 'src/rpc/server.cpp')
-rw-r--r-- | src/rpc/server.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 66ed18045e..83a352dbea 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -11,11 +11,13 @@ #include <util/strencodings.h> #include <util/string.h> #include <util/system.h> +#include <util/time.h> #include <boost/signals2/signal.hpp> #include <cassert> -#include <memory> // for unique_ptr +#include <chrono> +#include <memory> #include <mutex> #include <unordered_map> @@ -33,7 +35,7 @@ static bool ExecuteCommand(const CRPCCommand& command, const JSONRPCRequest& req struct RPCCommandExecutionInfo { std::string method; - int64_t start; + SteadyClock::time_point start; }; struct RPCServerInfo @@ -50,7 +52,7 @@ struct RPCCommandExecution explicit RPCCommandExecution(const std::string& method) { LOCK(g_rpc_server_info.mutex); - it = g_rpc_server_info.active_commands.insert(g_rpc_server_info.active_commands.end(), {method, GetTimeMicros()}); + it = g_rpc_server_info.active_commands.insert(g_rpc_server_info.active_commands.end(), {method, SteadyClock::now()}); } ~RPCCommandExecution() { @@ -231,7 +233,7 @@ static RPCHelpMan getrpcinfo() for (const RPCCommandExecutionInfo& info : g_rpc_server_info.active_commands) { UniValue entry(UniValue::VOBJ); entry.pushKV("method", info.method); - entry.pushKV("duration", GetTimeMicros() - info.start); + entry.pushKV("duration", int64_t{Ticks<std::chrono::microseconds>(SteadyClock::now() - info.start)}); active_commands.push_back(entry); } |