diff options
author | nicolargo <nicolas@nicolargo.com> | 2020-03-10 21:51:36 +0100 |
---|---|---|
committer | nicolargo <nicolas@nicolargo.com> | 2020-03-10 21:51:36 +0100 |
commit | 13b1d4303ab68b0b9d931ce63f8dacb26acb7032 (patch) | |
tree | 52e362b488de9383871ba911bff4e4cfc19302b2 | |
parent | e5e52e71fb94c7c59ed973949ea47190d03f2460 (diff) | |
parent | 054f8e35537920d6012e717e18c5bf49c9e9575b (diff) |
Merge branch 'develop' of github.com:nicolargo/glances into develop
-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 |