fix: Flaky test in ETLng (#2077)

Fixes a flaky test

Fix: https://github.com/XRPLF/clio/issues/2075

---------

Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
This commit is contained in:
Alex Kremer
2025-05-02 15:55:12 +01:00
committed by GitHub
parent 5d2c2a8bfc
commit 3daa735b31
2 changed files with 3 additions and 1 deletions

View File

@@ -89,6 +89,8 @@ createLedgerHeader(std::string_view ledgerHash, ripple::LedgerIndex seq, std::op
ledgerHeader.seq = seq;
if (age) {
// Note: be cautious of using age values close to each other as the underlying NetClock precision is seconds
// and the small time difference may lead to comparison bugs
auto const now = duration_cast<seconds>(system_clock::now().time_since_epoch());
auto const closeTime = (now - seconds{age.value()}).count() - kRIPPLE_EPOCH_START;
ledgerHeader.closeTime = ripple::NetClock::time_point{seconds{closeTime}};