Skip to content

Commit

Permalink
Merge pull request #2160 from petertodd/add-adjustedtime-to-rpc-getinfo
Browse files Browse the repository at this point in the history
Add adjustedtime to getinfo RPC call
  • Loading branch information
gavinandresen committed Feb 22, 2013
2 parents 49e332f + 8686f64 commit 802a3df
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/rpcwallet.cpp
Expand Up @@ -75,6 +75,7 @@ Value getinfo(const Array& params, bool fHelp)
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance())));
obj.push_back(Pair("blocks", (int)nBestHeight));
obj.push_back(Pair("timeoffset", (boost::int64_t)GetTimeOffset()));
obj.push_back(Pair("connections", (int)vNodes.size()));
obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string())));
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
Expand Down
7 changes: 6 additions & 1 deletion src/util.cpp
Expand Up @@ -1218,9 +1218,14 @@ void SetMockTime(int64 nMockTimeIn)

static int64 nTimeOffset = 0;

int64 GetTimeOffset()
{
return nTimeOffset;
}

int64 GetAdjustedTime()
{
return GetTime() + nTimeOffset;
return GetTime() + GetTimeOffset();
}

void AddTimeData(const CNetAddr& ip, int64 nTime)
Expand Down
1 change: 1 addition & 0 deletions src/util.h
Expand Up @@ -212,6 +212,7 @@ uint256 GetRandHash();
int64 GetTime();
void SetMockTime(int64 nMockTimeIn);
int64 GetAdjustedTime();
int64 GetTimeOffset();
std::string FormatFullVersion();
std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments);
void AddTimeData(const CNetAddr& ip, int64 nTime);
Expand Down

0 comments on commit 802a3df

Please sign in to comment.