mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-22 04:38:55 +02:00
Merge #21015: Make all of net_processing (and some of net) use std::chrono types
0eaea66e8bMake tx relay data structure use std::chrono types (Pieter Wuille)55e82881a1Make all Poisson delays use std::chrono types (Pieter Wuille)c733ac4d8aConvert block/header sync timeouts to std::chrono types (Pieter Wuille)4d98b401fbChange all ping times to std::chrono types (Pieter Wuille) Pull request description: (Picking up #20044. Rebased against master.) This changes various uses of integers to represent timestamps and durations to `std::chrono` duration types with type-safe conversions, getting rid of various `.count()`, constructors, and conversion factors. ACKs for top commit: jnewbery: utACK0eaea66e8bvasild: ACK0eaea66e8bMarcoFalke: re-ACK0eaea66e8b, only changes: minor rename, using C++11 member initializer, using 2min chrono literal, rebase 🤚 ajtowns: utACK0eaea66e8bTree-SHA512: 2dbd8d53bf82e98f9b4611e61dc14c448e8957d1a02575b837fadfd59f80e98614d0ccf890fc351f960ade76a6fb8051b282e252e81675a8ee753dba8b1d7f57
This commit is contained in:
@@ -26,9 +26,16 @@ void UninterruptibleSleep(const std::chrono::microseconds& n);
|
||||
* This helper is used to convert durations before passing them over an
|
||||
* interface that doesn't support std::chrono (e.g. RPC, debug log, or the GUI)
|
||||
*/
|
||||
inline int64_t count_seconds(std::chrono::seconds t) { return t.count(); }
|
||||
inline int64_t count_milliseconds(std::chrono::milliseconds t) { return t.count(); }
|
||||
inline int64_t count_microseconds(std::chrono::microseconds t) { return t.count(); }
|
||||
constexpr int64_t count_seconds(std::chrono::seconds t) { return t.count(); }
|
||||
constexpr int64_t count_milliseconds(std::chrono::milliseconds t) { return t.count(); }
|
||||
constexpr int64_t count_microseconds(std::chrono::microseconds t) { return t.count(); }
|
||||
|
||||
using SecondsDouble = std::chrono::duration<double, std::chrono::seconds::period>;
|
||||
|
||||
/**
|
||||
* Helper to count the seconds in any std::chrono::duration type
|
||||
*/
|
||||
inline double CountSecondsDouble(SecondsDouble t) { return t.count(); }
|
||||
|
||||
/**
|
||||
* DEPRECATED
|
||||
|
||||
Reference in New Issue
Block a user