Fix docs to clarify uptime output on Windows

This commit is contained in:
twangboy 2018-08-10 14:36:13 -06:00
parent 0d2a495378
commit 7fb1edb469
No known key found for this signature in database
GPG key ID: 93FF3BDEB278C9EB

View file

@ -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())