Fix time adjustments on latest boot (#1187)

* Fix time adjustments on latest boot

* Fix spell
This commit is contained in:
Pascal Vizeli 2019-08-06 09:24:22 +02:00 committed by GitHub
parent b7c07a2555
commit 882586b246
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -116,8 +116,7 @@ class HassIO(CoreSysAttributes):
await self.sys_addons.boot(STARTUP_APPLICATION)
# store new last boot
self.sys_config.last_boot = self.sys_hardware.last_boot
self.sys_config.save_data()
self._update_last_boot()
finally:
# Add core tasks into scheduler
@ -134,6 +133,9 @@ class HassIO(CoreSysAttributes):
# don't process scheduler anymore
self.sys_scheduler.suspend = True
# store new last boot / prevent time adjustments
self._update_last_boot()
# process async stop tasks
try:
with async_timeout.timeout(10):
@ -162,3 +164,8 @@ class HassIO(CoreSysAttributes):
await self.sys_addons.shutdown(STARTUP_SERVICES)
await self.sys_addons.shutdown(STARTUP_SYSTEM)
await self.sys_addons.shutdown(STARTUP_INITIALIZE)
def _update_last_boot(self):
"""Update last boot time."""
self.sys_config.last_boot = self.sys_hardware.last_boot
self.sys_config.save_data()