This refactors the sync variables to use `std::chrono::steady_clock` as it is best suitable for measuring intervals.
Backport of core#25079.
Differential D20434
index, refactor: Change sync variables to use `std::chrono::steady_clock` Authored by Fabien on Aug 4 2026, 12:28. Project Tags None Referenced Files None Subscribers None
Details
This refactors the sync variables to use `std::chrono::steady_clock` as it is best suitable for measuring intervals. Backport of core#25079. ninja all check-all
Diff Detail
Event TimelineComment Actions Build Bitcoin ABC Diffs / Diff Testing (ai-review) passed. Diff : committed changes only (\(\ ──────────────────────────────────────────────────────────────────────── minor [Data Integrity & Integration]
→ ]8;;vscode://file//work/src/index/base.cpp:158src/index/base.cpp:158-160]8;;
Initialize interval timestamps relative to sync start.
last_log_time and last_locator_write_time start at the steady_clock
epoch, not when ThreadSync() starts. If the clock has elapsed less than
30 seconds, the first progress log and Commit() are delayed. This
changes the previous immediate-first-check behavior.
Initialize both values from one start time minus their respective
intervals.
Proposed fix
- std::chrono::steady_clock::time_point last_log_time{0s};
- std::chrono::steady_clock::time_point last_locator_write_time{0s};
+ const auto sync_start = std::chrono::steady_clock::now();
+ auto last_log_time = sync_start - SYNC_LOG_INTERVAL;
+ auto last_locator_write_time =
+ sync_start - SYNC_LOCATOR_WRITE_INTERVAL;──────────────────────────────────────── Minor 1 1 file reviewed:
──────────────────────────────────────── Print all AI prompts: coderabbit review --show-prompts |