mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-14 06:32:33 +01:00
Merge bitcoin/bitcoin#25101: Add mockable clock type
fa305fd92cAdd mockable clock type and TicksSinceEpoch helper (MarcoFalke) Pull request description: This will be used primarily by the addr time refactor (https://github.com/bitcoin/bitcoin/pull/24697) to make addr relay time type safe. However, it can also be used in other places, and can be reviewed independently, so I split it up. ACKs for top commit: jonatack: ACKfa305fd92cper `git range-diff7b3343ffa20781 fa305fd` ajtowns: ACKfa305fd92cTree-SHA512: da00200126833c1f55b1b1e68f596eab5c9254e82b188ad17779c08ffd685e198a7c5270791b4b69a858dc6ba4e051fe0c8b445d203d356d0c884f6365ee1cfe
This commit is contained in:
@@ -44,7 +44,6 @@
|
||||
// trivial to get the mocked time from the server, nor is it needed for now, so
|
||||
// just use a plain system_clock.
|
||||
using CliClock = std::chrono::system_clock;
|
||||
using CliSeconds = std::chrono::time_point<CliClock, std::chrono::seconds>;
|
||||
|
||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||
UrlDecodeFn* const URL_DECODE = urlDecode;
|
||||
@@ -470,7 +469,7 @@ public:
|
||||
if (networkinfo["version"].getInt<int>() < 209900) {
|
||||
throw std::runtime_error("-netinfo requires bitcoind server to be running v0.21.0 and up");
|
||||
}
|
||||
const int64_t time_now{count_seconds(Now<CliSeconds>())};
|
||||
const int64_t time_now{TicksSinceEpoch<std::chrono::seconds>(CliClock::now())};
|
||||
|
||||
// Count peer connection totals, and if DetailsRequested(), store peer data in a vector of structs.
|
||||
for (const UniValue& peer : batch[ID_PEERINFO]["result"].getValues()) {
|
||||
|
||||
Reference in New Issue
Block a user