MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / elapsed_since

Function elapsed_since

src/global.rs:198–204  ·  view source on GitHub ↗

Returns how many seconds have elapsed since a persisted timestamp. User config timestamps can land in the future because of clock skew, manual edits, or state copied across machines. Clamp those cases to zero so cooldown/version-cache logic degrades gracefully instead of getting stuck on a negative delta.

(now: i64, recorded_at: i64)

Source from the content-addressed store, hash-verified

196/// cooldown/version-cache logic degrades gracefully instead of getting stuck on
197/// a negative delta.
198fn elapsed_since(now: i64, recorded_at: i64) -> i64 {
199 if recorded_at >= now {
200 0
201 } else {
202 now - recorded_at
203 }
204}
205
206/// Best-effort: register this project in the user-level global DB and
207/// accumulate the token savings delta into the pending upload counter.

Callers 2

try_flushFunction · 0.85
check_for_updateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected