提交 105aa65f 编写于 作者: N nicolargo

Correct an issue on Windows, time zone not display correctly. Skip it for the moment

上级 2c9e80b4
......@@ -22,6 +22,7 @@
from time import tzname, localtime
from datetime import datetime
from glances.globals import WINDOWS
from glances.plugins.glances_plugin import GlancesPlugin
......@@ -49,11 +50,12 @@ class Plugin(GlancesPlugin):
"""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 and issue #1337)
if 'tmzone' in localtime():
self.stats += ' {}'.format(localtime().tm_zone)
elif len(tzname) > 0:
self.stats += ' {}'.format(tzname[1])
# 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])
return self.stats
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册