[RPC] Add an uptime command that displays the amount of time that bitcoind has been running
This commit is contained in:
committed by
lateminer
parent
5a5d74b07c
commit
32f0591954
@@ -273,6 +273,22 @@ UniValue stop(const UniValue& params, bool fHelp)
|
||||
return "Blackcoin server stopping";
|
||||
}
|
||||
|
||||
UniValue uptime(const JSONRPCRequest& jsonRequest)
|
||||
{
|
||||
if (jsonRequest.fHelp || jsonRequest.params.size() > 1)
|
||||
throw std::runtime_error(
|
||||
"uptime\n"
|
||||
"\nReturns the total uptime of the server.\n"
|
||||
"\nResult:\n"
|
||||
"ttt (numeric) The number of seconds that the server has been running\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("uptime", "")
|
||||
+ HelpExampleRpc("uptime", "")
|
||||
);
|
||||
|
||||
return GetTime() - GetStartupTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Call Table
|
||||
*/
|
||||
@@ -282,6 +298,7 @@ static const CRPCCommand vRPCCommands[] =
|
||||
/* Overall control/query calls */
|
||||
{ "control", "help", &help, true },
|
||||
{ "control", "stop", &stop, true },
|
||||
{ "control", "uptime", &uptime, true, },
|
||||
};
|
||||
|
||||
CRPCTable::CRPCTable()
|
||||
|
||||
Reference in New Issue
Block a user