platypush/platypush/plugins/bluetooth/_ble
Fabio Manganiello c9a5c29a4a
🐛 A proper cross-version solution for the utcnow() issue.
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
2024-06-01 01:34:47 +02:00
..
_plugins Removed typing-extensions dependency. 2023-09-18 14:05:39 +02:00
__init__.py [WIP] Big, big refactor of the Bluetooth integration. 2023-03-13 02:31:21 +01:00
_cache.py Removed typing-extensions dependency. 2023-09-18 14:05:39 +02:00
_connection.py [WIP] Big, big refactor of the Bluetooth integration. 2023-03-13 02:31:21 +01:00
_event_handler.py 🐛 A proper cross-version solution for the utcnow() issue. 2024-06-01 01:34:47 +02:00
_manager.py Removed typing-extensions dependency. 2023-09-18 14:05:39 +02:00
_mappers.py s/TimeDurationSensor/TimeDuration/g 2023-04-02 00:57:48 +02:00