diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 90a68f560..21eb2fd1a 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -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())); diff --git a/src/util.cpp b/src/util.cpp index d8f05cb9f..1f66aff60 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -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) diff --git a/src/util.h b/src/util.h index 97911d749..2050604e5 100644 --- a/src/util.h +++ b/src/util.h @@ -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& comments); void AddTimeData(const CNetAddr& ip, int64 nTime);