From ab0742b10333be658b5eea6447f1e1387c8200f2 Mon Sep 17 00:00:00 2001 From: Bharath Vignesh J K <52282402+RazCrimson@users.noreply.github.com> Date: Mon, 29 Apr 2024 01:47:38 +0530 Subject: [PATCH] fix: plugin (alert) - pytz not working with time.tzname for some timezones --- glances/plugins/alert/__init__.py | 5 +---- 1 file changed, 1 insertion(+), 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: