mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-26 10:42:29 +03:00
Add time zone to the current time #1249
This commit is contained in:
parent
aafcb63b29
commit
e3e1aaf303
1
NEWS
1
NEWS
@ -24,6 +24,7 @@ Enhancements and new features:
|
|||||||
* Display debug message if dep lib is not found #1224
|
* Display debug message if dep lib is not found #1224
|
||||||
* Add a new output mode to stdout #1168
|
* Add a new output mode to stdout #1168
|
||||||
* Huge refactor of the WebUI packaging thanks to @spike008t #1239
|
* Huge refactor of the WebUI packaging thanks to @spike008t #1239
|
||||||
|
* Add time zone to the current time #1249
|
||||||
|
|
||||||
One more thing ! A new Grafana Dash is available with:
|
One more thing ! A new Grafana Dash is available with:
|
||||||
* Network interface variable
|
* Network interface variable
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
"""Now (current date) plugin."""
|
"""Now (current date) plugin."""
|
||||||
|
|
||||||
|
from time import tzname
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from glances.plugins.glances_plugin import GlancesPlugin
|
from glances.plugins.glances_plugin import GlancesPlugin
|
||||||
@ -48,6 +49,8 @@ class Plugin(GlancesPlugin):
|
|||||||
"""Update current date/time."""
|
"""Update current date/time."""
|
||||||
# Had to convert it to string because datetime is not JSON serializable
|
# Had to convert it to string because datetime is not JSON serializable
|
||||||
self.stats = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
self.stats = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||||
|
# Add the time zone (issue#1249)
|
||||||
|
self.stats += ' {}'.format(tzname[0])
|
||||||
|
|
||||||
return self.stats
|
return self.stats
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user