Coverage for /home/admin/Documents/AI/applications/lexigram-dev/lexigram/experimental/ai/lexigram-ai-llm/src/lexigram/ai/llm/routing/backends/_time.py: 67%

6 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-25 07:19 +0800

1"""Shared time helpers for quota backends.""" 

2 

3from __future__ import annotations 

4 

5from datetime import UTC, datetime, time, timedelta 

6 

7__all__ = ["end_of_utc_day"] 

8 

9 

10def end_of_utc_day() -> datetime: 

11 """Return the first instant of the next UTC day. 

12 

13 Used as the default exhaustion expiry (legacy "rest of today" 

14 semantics) when ``mark_exhausted`` is called without ``until``. 

15 """ 

16 tomorrow = datetime.now(UTC).date() + timedelta(days=1) 

17 return datetime.combine(tomorrow, time.min, tzinfo=UTC)