diff options
Diffstat (limited to 'glances/plugins/glances_now.py')
-rw-r--r-- | glances/plugins/glances_now.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/glances/plugins/glances_now.py b/glances/plugins/glances_now.py index c549335a..254d71b8 100644 --- a/glances/plugins/glances_now.py +++ b/glances/plugins/glances_now.py @@ -19,8 +19,7 @@ """Now (current date) plugin.""" -from time import tzname, localtime -from datetime import datetime +from time import tzname, localtime, strftime from glances.globals import WINDOWS from glances.plugins.glances_plugin import GlancesPlugin @@ -49,13 +48,11 @@ class Plugin(GlancesPlugin): def update(self): """Update current date/time.""" # Had to convert it to string because datetime is not JSON serializable - self.stats = datetime.now().strftime('%Y-%m-%d %H:%M:%S') # Add the time zone (issue #1249 / #1337 / #1598) - if not WINDOWS: - if 'tmzone' in localtime(): - self.stats += ' {}'.format(localtime().tm_zone) - elif len(tzname) > 0: - self.stats += ' {}'.format(tzname[1]) + if (len(tzname[1]) > 6): + self.stats = strftime('%Y-%m-%d %H:%M:%S %z') + else: + self.stats = strftime('%Y-%m-%d %H:%M:%S %Z') return self.stats |