forked from platypush/platypush
Fabio Manganiello
c9a5c29a4a
No need to maintain two different pieces of logic - a `utcnow()` for Python < 3.11 and `now(datetime.UTC)` for Python >= 3.11. `datetime.timezone.utc` existed long before datetime.UTC and that's what the `utcnow` facade should use. This means that all the `utcnow()` will always have `tzinfo=UTC` regardless of the Python version. There's still a problem with the `utcnow()`-generated timestamps that have been generated by previous versions of Python and stored on the db. Therefore, when the code performs comparisons with timestamps fetched from the db, it should always explicitly do a `.replace(tzinfo=utc)` to ensure that we always compare offset-aware datetime representations. See blog post for technical details: https://manganiello.blog/wheres-my-time-again |
||
---|---|---|
.. | ||
_ble | ||
_file | ||
_legacy | ||
_model | ||
_plugins | ||
__init__.py | ||
_cache.py | ||
_manager.py | ||
_types.py | ||
manifest.json | ||
model.py |