I think we should allow the use of chrono literals for new code to make it less verbose. Obviously old code can stay as-is.
This patch pulls in the needed namespace and replaces some lines for illustrative purposes.
I think we should allow the use of chrono literals for new code to make it less verbose. Obviously old code can stay as-is.
This patch pulls in the needed namespace and replaces some lines for illustrative purposes.
ACK fa11110bff6288f63e0c487e2e4b4079fb0f4569
If std::atomic
is not involved, then
0std::chrono:milliseconds foo = std::chrono::milliseconds{100};
can be replaced with:
0auto foo = 100ms;
static constexpr auto TXID_RELAY_DELAY = std::chrono::seconds{2};
)
can be replaced with:
Would it also be possible to change the net_processing.cpp constexpr?
Yes, it is possible to change existing code, but as this is a purely stylistic change, it might be better to do it when the code is touched for other reasons.
The only goal of this pull is to pull in the namespace and show that it was pulled in by replacing a few lines.
5@@ -6,9 +6,11 @@
6 #ifndef BITCOIN_UTIL_TIME_H
7 #define BITCOIN_UTIL_TIME_H
8
9+#include <chrono>
10 #include <stdint.h>
11 #include <string>
12-#include <chrono>
13+
14+using namespace std::chrono_literals;
using namespace std::literals::chrono_literals;
appear to be valid
ACK fa11110bff6288f63e0c487e2e4b4079fb0f4569
a few resources