fix(audit): centraliser l'horloge UTC
CI - Security, Lint & Tests / validate (push) Failing after 16m22s
CI - Security, Lint & Tests / validate (push) Failing after 16m22s
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
"""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)
|
||||
Reference in New Issue
Block a user