Apply suggestions from code review

Co-authored-by: str4d <thestr4d@gmail.com>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Kris Nuttycombe 2022-07-14 16:30:55 -06:00 committed by Kris Nuttycombe
parent e7922af588
commit 0a4f3a3df0
3 changed files with 11 additions and 10 deletions

View File

@ -500,8 +500,7 @@ UniValue setmocktime(const UniValue& params, bool fHelp)
"\nSet the local time to given timestamp (-regtest only).\n"
"The node must be started with `-mocktime` in order to use this API.\n"
"\nArguments:\n"
"1. timestamp (integer, required) Unix seconds-since-epoch timestamp\n"
" Pass 0 to go back to using the system time."
"1. timestamp (integer, required) Unix seconds-since-epoch timestamp."
);
if (!Params().MineBlocksOnDemand())

View File

@ -15,7 +15,9 @@
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/thread.hpp>
// This guards accesses to FixedClock and OffsetClock.
RecursiveMutex cs_clock;
static CClock* zcashdClock = SystemClock::Instance();
const CClock* GetNodeClock() {

View File

@ -24,8 +24,8 @@ class SystemClock: public CClock {
private:
SystemClock() {}
~SystemClock() {}
SystemClock(SystemClock const&) = delete;
SystemClock& operator=(const SystemClock&)= delete;
SystemClock(SystemClock const&) = delete;
SystemClock& operator=(const SystemClock&) = delete;
public:
static SystemClock* Instance() {
static SystemClock instance;
@ -33,8 +33,8 @@ public:
}
/**
* Sets the clock used by zcashd to the system clock. This must only be
* called by `init()`, or in tests.
* Sets the clock used by zcashd to the system clock. This is not thread-safe,
* and must only be called in a single-threaded context such as `init`.
*/
static void SetGlobal();
@ -56,8 +56,8 @@ public:
}
/**
* Sets the clock used by zcashd to a fixed clock. This must only be used
* by `init()`, or in tests.
* Sets the clock used by zcashd to a fixed clock. This is not thread-safe
* and must only be called in a single-threaded context such as `init`.
*/
static void SetGlobal();
@ -81,8 +81,8 @@ public:
/**
* Sets the clock used by zcashd to a clock that returns the current system
* time modified by the specified offset. This must only be called by
* `init()`, or in tests.
* time modified by the specified offset. This is not thread-safe and must
* only be called in a single-threaded context such as `init`.
*/
static void SetGlobal();