-
Notifications
You must be signed in to change notification settings - Fork 35.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make all of net_processing (and some of net) use std::chrono types #20044
Conversation
Concept ACK |
Concept ACK. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Concept ACK. Is it worth waiting for C++17 and switching directly to chrono literals (eg https://en.cppreference.com/w/cpp/chrono/operator%22%22h)? |
And operator++ ;) https://en.cppreference.com/w/cpp/chrono/duration/operator_arith2 |
8d9a5c4
to
50ede47
Compare
That would be nice, but it's also kind of an independent improvement (there are a bunch of time durations constants in the code that aren't touched by this PR). I don't like waiting for C++17, as we don't actually know when that may happen. I saw there were some issues with using C++17's std::filesystem, which may push things back for example (I may be mistaken here, but in general I don't like a "We shouldn't do X yet, because we expect that Soon(tm) we will be able to do it better"). |
Oh that's fair. I don't know why I was conflating "not being able to use certain C++17 features like std::filesystem" with "not being able to switch compilation to C++17". |
Concept ACK |
50ede47
to
2430b13
Compare
2430b13
to
e1fc641
Compare
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
Still needs rebase. Let me know if this is up for grabs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, apparently I started a review of this at some point and got distracted?
Concept ACK
if (stats.m_ping_usec > 0) { | ||
obj.pushKV("pingtime", ((double)stats.m_ping_usec) / 1e6); | ||
if (stats.m_ping_time.count() > 0) { | ||
obj.pushKV("pingtime", count_microseconds(stats.m_ping_time) * 0.000001); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* 1e-6
?
@sipa Weekly ping to ask whether this is up for grabs :) |
This is up for grabs. |
I'll take a swing at rebasing this code shortly. |
@dhruv Excellent! I subscribe as reviewer :) |
#21015 is ready for review. |
…hrono types 0eaea66 Make tx relay data structure use std::chrono types (Pieter Wuille) 55e8288 Make all Poisson delays use std::chrono types (Pieter Wuille) c733ac4 Convert block/header sync timeouts to std::chrono types (Pieter Wuille) 4d98b40 Change 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: utACK 0eaea66 vasild: ACK 0eaea66 MarcoFalke: re-ACK 0eaea66, only changes: minor rename, using C++11 member initializer, using 2min chrono literal, rebase 🤚 ajtowns: utACK 0eaea66 Tree-SHA512: 2dbd8d53bf82e98f9b4611e61dc14c448e8957d1a02575b837fadfd59f80e98614d0ccf890fc351f960ade76a6fb8051b282e252e81675a8ee753dba8b1d7f57
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.Builds on #20027.