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 fabae3541a
-
MarcoFalke force-pushed on Jun 23, 2022
-
laanwj commented at 1:40 pm on June 23, 2022: memberCode review ACK fabae3541ac574a1101be8dc54f1499dbbf2f231
-
w0xlt approved
-
w0xlt commented at 5:44 pm on June 23, 2022: contributor
-
shaavan approved
-
shaavan commented at 1:07 pm on June 24, 2022: contributor
Code 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.
- I agree with using
-
MarcoFalke merged this on Jun 24, 2022
-
MarcoFalke closed this on Jun 24, 2022
-
MarcoFalke deleted the branch on Jun 24, 2022
-
sidhujag referenced this in commit 69cf3b1ddc on Jun 27, 2022
-
MarcoFalke referenced this in commit 7d258ee8bc on Jul 12, 2022
-
sidhujag referenced this in commit 49dde5dcc5 on Jul 12, 2022
-
DrahtBot locked this on Jun 24, 2023
MarcoFalke
laanwj
w0xlt
shaavan
Labels
RPC/REST/ZMQ