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
  1. MarcoFalke commented at 1:16 pm on June 23, 2022: member
    Currently it uses GetTimeMicros, which is the system time. Using steady time instead, makes the code type safe and avoids spurious offsets when the system time adjusts.
  2. fanquake added the label RPC/REST/ZMQ on Jun 23, 2022
  3. 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.
  4. rpc: Use steady_clock for getrpcinfo durations fabae3541a
  5. MarcoFalke force-pushed on Jun 23, 2022
  6. laanwj commented at 1:40 pm on June 23, 2022: member
    Code review ACK fabae3541ac574a1101be8dc54f1499dbbf2f231
  7. w0xlt approved
  8. w0xlt commented at 5:44 pm on June 23, 2022: contributor
  9. shaavan approved
  10. shaavan commented at 1:07 pm on June 24, 2022: contributor

    Code Review ACK fabae3541ac574a1101be8dc54f1499dbbf2f231

    • I agree with using steady_clock::now for getrpcinfo instead of system_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.
  11. MarcoFalke merged this on Jun 24, 2022
  12. MarcoFalke closed this on Jun 24, 2022

  13. MarcoFalke deleted the branch on Jun 24, 2022
  14. sidhujag referenced this in commit 69cf3b1ddc on Jun 27, 2022
  15. MarcoFalke referenced this in commit 7d258ee8bc on Jul 12, 2022
  16. sidhujag referenced this in commit 49dde5dcc5 on Jul 12, 2022
  17. DrahtBot locked this on Jun 24, 2023

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-07-03 13:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me