mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix docs to clarify uptime output on Windows
This commit is contained in:
parent
0d2a495378
commit
7fb1edb469
1 changed files with 18 additions and 5 deletions
|
@ -14,6 +14,7 @@ from __future__ import absolute_import
|
|||
import datetime
|
||||
import logging
|
||||
import subprocess
|
||||
import time
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
# Import Salt Libs
|
||||
|
@ -189,17 +190,29 @@ def uptime(human_readable=False):
|
|||
'''
|
||||
.. versionadded:: 2015.8.0
|
||||
|
||||
Return the system uptime for this machine in seconds
|
||||
Return the system uptime for the machine
|
||||
|
||||
human_readable : False
|
||||
If ``True``, then return uptime in years, days, and seconds.
|
||||
Args:
|
||||
|
||||
human_readable (bool):
|
||||
Return uptime in human readable format if ``True``, otherwise
|
||||
return seconds. Default is ``False``
|
||||
|
||||
.. note::
|
||||
Human readable format is ``days, hours:min:sec``. Days will only
|
||||
be displayed if more than 0
|
||||
|
||||
Returns:
|
||||
str:
|
||||
The uptime in seconds or human readable format depending on the
|
||||
value of ``human_readable``
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' status.uptime
|
||||
salt '*' status.uptime human_readable=True
|
||||
salt '*' status.uptime
|
||||
salt '*' status.uptime human_readable=True
|
||||
'''
|
||||
# Get startup time
|
||||
startup_time = datetime.datetime.fromtimestamp(psutil.boot_time())
|
||||
|
|
Loading…
Add table
Reference in a new issue