MCPcopy Create free account
hub / github.com/codeaashu/claude-code / computeTimeProgress

Function computeTimeProgress

src/services/claudeAiLimits.ts:98–103  ·  view source on GitHub ↗

* Calculate what fraction of a time window has elapsed. * Used for time-relative early warning fallback. * @param resetsAt - Unix epoch timestamp in seconds when the limit resets * @param windowSeconds - Duration of the window in seconds * @returns fraction (0-1) of the window that has elapsed

(resetsAt: number, windowSeconds: number)

Source from the content-addressed store, hash-verified

96 * @returns fraction (0-1) of the window that has elapsed
97 */
98function computeTimeProgress(resetsAt: number, windowSeconds: number): number {
99 const nowSeconds = Date.now() / 1000
100 const windowStart = resetsAt - windowSeconds
101 const elapsed = nowSeconds - windowStart
102 return Math.max(0, Math.min(1, elapsed / windowSeconds))
103}
104
105// Reason why overage is disabled/rejected
106// These values come from the API's unified limiter

Callers 1

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected