summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBharath Vignesh J K <52282402+RazCrimson@users.noreply.github.com>2024-04-29 01:47:38 +0530
committerBharath Vignesh J K <52282402+RazCrimson@users.noreply.github.com>2024-04-29 01:48:19 +0530
commitab0742b10333be658b5eea6447f1e1387c8200f2 (patch)
treeda2dd27e3cf922e7e459cea97db95da0a85b67c2
parent8b6b4788b85f25347ebf5e6296ddad955a32e3c5 (diff)
fix: plugin (alert) - pytz not working with time.tzname for some timezones2659-crash-when-reading-timezone-for-generating-alert
-rw-r--r--glances/plugins/alert/__init__.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/glances/plugins/alert/__init__.py b/glances/plugins/alert/__init__.py
index e88c4a72..5f8f626b 100644
--- a/glances/plugins/alert/__init__.py
+++ b/glances/plugins/alert/__init__.py
@@ -10,8 +10,6 @@
"""Alert plugin."""
from datetime import datetime
-from time import tzname
-import pytz
from glances.logger import logger
from glances.events_list import glances_events
@@ -152,8 +150,7 @@ class PluginModel(GlancesPluginModel):
# New line
ret.append(self.curse_new_line())
# Start
- msg = str(datetime.fromtimestamp(alert['begin'],
- tz=pytz.timezone(tzname[0] if tzname[0] else 'UTC')))
+ msg = str(datetime.fromtimestamp(alert['begin'], tz=datetime.now().astimezone().tzinfo))
ret.append(self.curse_add_line(msg))
# Duration
if alert['end'] > 0: