summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-18 17:04:57 +0000
committeraur-build <aur-build@localhost>2026-11-18 17:04:57 +0000
commite7922f3dd1d985dcb993b624146b2492183f3a11 (patch)
treeb385961b9799c66240c9655a65236133199d0a71 /src/lib.rs
parent41fa1684de8eb13c5b76c3a3e174fece04ac5afa (diff)
downloadaur-build-e7922f3dd1d985dcb993b624146b2492183f3a11.tar.gz
aur-build-e7922f3dd1d985dcb993b624146b2492183f3a11.zip
time: relative arithmetic honors the pinned clock
`now()` returned the pinned instant when a test had pinned one, but `secs_ago`/`secs_ahead` called `Utc::now()` directly (m-1). Anything built from them — every lease expiry, every `next_check_at`, every cooldown cutoff — was therefore computed against the real wall clock and then compared against the pinned one. A test that pinned 2026-01-01 and took a 90-second lease got an expiry 90 seconds after *today*, so the reaper comparing `lease_expires_at < now()` saw a lease that would not expire for a century, or one that had expired millions of seconds ago, depending on which way the pin pointed. The test still passed, because nothing asserted on the number. Both now go through a `base()` that reads the pinned instant, so a pinned test computes and compares on the same clock. `tests/time.rs` pins the arithmetic directly and then does the thing the bug actually broke: claim a lease under a pinned clock, assert the expiry is 90 seconds after the pinned now, assert the reaper sees nothing yet, advance the pinned clock 91 seconds, and assert it reaps.
Diffstat (limited to 'src/lib.rs')
0 files changed, 0 insertions, 0 deletions