diff --git a/CHANGELOG.md b/CHANGELOG.md index 48d6290..838ddd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - replaced [PEP526](https://www.python.org/dev/peps/pep-0526/#abstract)-style variable type hints with [PEP484](https://www.python.org/dev/peps/pep-0484/)-compatible - fixed `AttributeError` due to unavailable `MagicMock.assert_called_once` + - fixed `TypeError` when calling `datetime.datetime.isoformat(datespec=…)` ## [0.1.0] - 2020-06-16 ### Added diff --git a/systemctl_mqtt/__init__.py b/systemctl_mqtt/__init__.py index 1140365..7035d17 100644 --- a/systemctl_mqtt/__init__.py +++ b/systemctl_mqtt/__init__.py @@ -46,10 +46,10 @@ def _schedule_shutdown(action: str) -> None: # https://github.com/systemd/systemd/blob/v237/src/systemctl/systemctl.c#L8553 assert action in ["poweroff", "reboot"], action shutdown_datetime = datetime.datetime.now() + _SHUTDOWN_DELAY + # datetime.datetime.isoformat(timespec=) not available in python3.5 + # https://github.com/python/cpython/blob/v3.5.9/Lib/datetime.py#L1552 _LOGGER.info( - "scheduling %s for %s", - action, - shutdown_datetime.isoformat(sep=" ", timespec="seconds"), + "scheduling %s for %s", action, shutdown_datetime.strftime("%Y-%m-%d %H:%M:%S"), ) shutdown_epoch_usec = int(shutdown_datetime.timestamp() * 10 ** 6) try: