Page MenuHomePhabricator

Add time helpers for std::chrono::steady_clock, Remove unused GetTimeSeconds
ClosedPublic

Authored by PiRK on Jun 5 2023, 12:12.

Details

Summary

Add time helpers for std::chrono::steady_clock

random: Add FastRandomContext::rand_uniform_delay

Remove unused GetTimeSeconds

Seems confusing to have this helper when it is possible to get the system time in a type-safe way by simply calling std::chrono::system_clock::now (C++11).

This patch replaces GetTimeSeconds and removes it:

  • in bitcoin-cli.cpp by system_clock
  • in test/fuzz/fuzz.cpp by steady_clock

This is a backport of core#24921 and core#25102

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Jun 5 2023, 12:12
Fabien requested changes to this revision.Jun 5 2023, 17:01
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/bitcoin-cli.cpp
30 ↗(On Diff #40594)

Revert, they were at the right place before

src/util/time.h
90 ↗(On Diff #40594)
91 ↗(On Diff #40594)
This revision now requires changes to proceed.Jun 5 2023, 17:01

revert moving of includes

and fix spelling in doxyxgn comment

Fabien added inline comments.
src/bitcoin-cli.cpp
26 ↗(On Diff #40604)

Moving this one was correct, but that's the only one

This revision is now accepted and ready to land.Jun 6 2023, 05:52

move compat/stdin.h to internal includes