feat: finish register receiving and authority routing
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a023c0-a0a3-7c03-b395-5a0d2757214d
This commit is contained in:
parent
6d134425df
commit
d103955217
28 changed files with 970 additions and 48 deletions
26
src/repo_manager/time.py
Normal file
26
src/repo_manager/time.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
"""Canonical UTC time helpers (RMGR-ADR-002)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import UTC, date, datetime
|
||||
|
||||
|
||||
def utc_now() -> datetime:
|
||||
"""Return the current timezone-aware UTC instant."""
|
||||
return datetime.now(UTC)
|
||||
|
||||
|
||||
def format_utc(value: datetime) -> str:
|
||||
"""Serialize an aware instant as canonical RFC 3339 UTC with ``Z``."""
|
||||
if value.tzinfo is None or value.utcoffset() is None:
|
||||
raise ValueError("timestamp must be timezone-aware")
|
||||
return value.astimezone(UTC).isoformat().replace("+00:00", "Z")
|
||||
|
||||
|
||||
def utc_now_text() -> str:
|
||||
return format_utc(utc_now())
|
||||
|
||||
|
||||
def utc_today() -> date:
|
||||
"""Return the calendar date derived from the current UTC instant."""
|
||||
return utc_now().date()
|
||||
Loading…
Add table
Add a link
Reference in a new issue