17 lines
582 B
Python
17 lines
582 B
Python
"""Источник времени для audit_log и снимков состояния.
|
|
|
|
Отдельный модуль — чтобы тесты могли подменять время детерминированно
|
|
(``monkeypatch.setattr(clock, "utcnow", ...)``).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import UTC, datetime
|
|
|
|
__all__ = ["utcnow"]
|
|
|
|
|
|
def utcnow() -> str:
|
|
"""Текущее время в UTC: ISO-8601, миллисекунды, суффикс ``Z``."""
|
|
return datetime.now(UTC).isoformat(timespec="milliseconds").replace("+00:00", "Z")
|