mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-12-24 12:29:08 +00:00
Time handling (#2901)
* Add new time handling * migrate date for python3.9 * add timedate * add tests & simplify it * better testing * use ssl * use hostname with new interface * expose to API * update data * add base handler * new timezone handling * improve handling * Improve handling * Add tests * Time adjustment function * Fix logging * tweak condition * don't adjust synchronized time * Guard * ignore UTC * small cleanup * like that, we can leaf it * add URL * add comment * Apply suggestions from code review Co-authored-by: Joakim Sørensen <joasoe@gmail.com> Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
This commit is contained in:
@@ -91,6 +91,15 @@ class CoreSys:
|
||||
"""Return True if we run dev mode."""
|
||||
return bool(os.environ.get(ENV_SUPERVISOR_DEV, 0))
|
||||
|
||||
@property
|
||||
def timezone(self) -> str:
|
||||
"""Return system timezone."""
|
||||
if self.config.timezone:
|
||||
return self.config.timezone
|
||||
if self.host.info.timezone:
|
||||
return self.host.info.timezone
|
||||
return "UTC"
|
||||
|
||||
@property
|
||||
def loop(self) -> asyncio.BaseEventLoop:
|
||||
"""Return loop object."""
|
||||
@@ -463,6 +472,11 @@ class CoreSysAttributes:
|
||||
|
||||
coresys: CoreSys
|
||||
|
||||
@property
|
||||
def sys_timezone(self) -> str:
|
||||
"""Return system internal used timezone."""
|
||||
return self.coresys.timezone
|
||||
|
||||
@property
|
||||
def sys_machine(self) -> Optional[str]:
|
||||
"""Return running machine type of the Supervisor system."""
|
||||
|
||||
Reference in New Issue
Block a user