Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions framework/python/src/common/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import typing as t
import netifaces
from common import logger
import tzlocal

LOGGER = logger.get_logger('util')

Expand Down Expand Up @@ -153,3 +154,14 @@ def diff_dicts(d1: t.Dict[t.Any, t.Any], d2: t.Dict[t.Any, t.Any]) -> t.Dict:
if items_added:
diff['items_added'] = items_added
return diff


def get_system_timezone() -> str:
"""Returns the local timezone of the system."""
try:
local_timezone = tzlocal.get_localzone()
return str(local_timezone)
except Exception as e:
LOGGER.error(f'Error getting local timezone: {e}')
return 'UTC'

3 changes: 3 additions & 0 deletions framework/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ APScheduler==3.10.4
Jinja2==3.1.6
beautifulsoup4==4.12.3
html5lib==1.1

# Requirements for timezone handling
tzlocal==5.4.3
4 changes: 4 additions & 0 deletions modules/test/base/python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ netifaces==0.11.0

# Requirements for reports generation
Jinja2==3.1.6

# Requirements for timezone handling
tzlocal==5.4.3

Loading