GetTimeMicros
, which is the system time. Using steady time instead, makes the code type safe and avoids spurious offsets when the system time adjusts.
rpc: Use steady_clock for getrpcinfo durations #25456
pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2206-rpc-steady-duration-🎴 changing 2 files +14 −5-
MarcoFalke commented at 1:16 pm on June 23, 2022: memberCurrently it uses
-
fanquake added the label RPC/REST/ZMQ on Jun 23, 2022
-
in src/rpc/server.cpp:24 in fabef13e94 outdated
20+#include <chrono> 21+#include <memory> 22 #include <mutex> 23 #include <unordered_map> 24 25+using SysClock = std::chrono::system_clock;
laanwj commented at 1:21 pm on June 23, 2022:That’s not steady_clock, right?
MarcoFalke commented at 1:34 pm on June 23, 2022:Looks like a data point to show my brain stops working at 31°C
laanwj commented at 1:40 pm on June 23, 2022:Heeh same over here. Ugh.rpc: Use steady_clock for getrpcinfo durations fabae3541aMarcoFalke force-pushed on Jun 23, 2022laanwj commented at 1:40 pm on June 23, 2022: memberCode review ACK fabae3541ac574a1101be8dc54f1499dbbf2f231w0xlt approvedw0xlt commented at 5:44 pm on June 23, 2022: contributorshaavan approvedshaavan commented at 1:07 pm on June 24, 2022: contributorCode Review ACK fabae3541ac574a1101be8dc54f1499dbbf2f231
- I agree with using
steady_clock::now
forgetrpcinfo
instead ofsystem_clock::now
, for the reason given in the description. - Here is a helpful article I found regarding the difference between the two, and it helps explains why
steady_clock
is the better choice in this case.
MarcoFalke merged this on Jun 24, 2022MarcoFalke closed this on Jun 24, 2022
MarcoFalke deleted the branch on Jun 24, 2022sidhujag referenced this in commit 69cf3b1ddc on Jun 27, 2022MarcoFalke referenced this in commit 7d258ee8bc on Jul 12, 2022sidhujag referenced this in commit 49dde5dcc5 on Jul 12, 2022DrahtBot locked this on Jun 24, 2023
MarcoFalke laanwj w0xlt shaavanLabels
RPC/REST/ZMQ
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 18:12 UTC
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-17 18:12 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me