20 lines
768 B
Python
20 lines
768 B
Python
"""Time helpers with explicit storage semantics.
|
|
|
|
The deployed schema currently stores timestamps in ``DateTime`` columns
|
|
without timezone information. Until the real PostgreSQL schema is restored
|
|
and migrated, application timestamps must therefore remain naive values.
|
|
They are nevertheless generated from an aware UTC clock so the convention is
|
|
explicit and does not rely on the deprecated :meth:`datetime.utcnow` API.
|
|
"""
|
|
|
|
from datetime import UTC, datetime
|
|
|
|
|
|
def utc_now_naive() -> datetime:
|
|
"""Return the current UTC instant without ``tzinfo`` for legacy columns.
|
|
|
|
Replace this compatibility boundary with aware UTC values when the
|
|
corresponding columns are migrated to timezone-aware types.
|
|
"""
|
|
return datetime.now(UTC).replace(tzinfo=None)
|