...instead pass in a std::function<int64_t()> Note that the static_cast is needed (apparently) for the compiler to know which overloaded GetTime to choose.
Partial backport of core#23280:
https://github.com/bitcoin/bitcoin/pull/23280/commits/05441c2dc5f60e2025476d8ec94c9025032d118c
Depends on D12576.