summaryrefslogtreecommitdiffstats
path: root/glances/plugins/glances_now.py
diff options
context:
space:
mode:
Diffstat (limited to 'glances/plugins/glances_now.py')
-rw-r--r--glances/plugins/glances_now.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/glances/plugins/glances_now.py b/glances/plugins/glances_now.py
index 254d71b8..d3edb839 100644
--- a/glances/plugins/glances_now.py
+++ b/glances/plugins/glances_now.py
@@ -41,6 +41,12 @@ class Plugin(GlancesPlugin):
# Set the message position
self.align = 'bottom'
+ if args.strftime_format:
+ self.strftime = args.strftime_format
+ elif config is not None:
+ if 'global' in config.as_dict():
+ self.strftime = config.as_dict()['global']['strftime_format']
+
def reset(self):
"""Reset/init the stats."""
self.stats = ''
@@ -49,10 +55,14 @@ class Plugin(GlancesPlugin):
"""Update current date/time."""
# Had to convert it to string because datetime is not JSON serializable
# Add the time zone (issue #1249 / #1337 / #1598)
- if (len(tzname[1]) > 6):
- self.stats = strftime('%Y-%m-%d %H:%M:%S %z')
+
+ if self.strftime:
+ self.stats = strftime(self.strftime)
else:
- self.stats = strftime('%Y-%m-%d %H:%M:%S %Z')
+ 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