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)
| 196 | /// cooldown/version-cache logic degrades gracefully instead of getting stuck on |
| 197 | /// a negative delta. |
| 198 | fn 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. |
no outgoing calls
no test coverage detected