spug/spug_api/apps/monitor/utils.py

13 lines
432 B
Python

# Copyright: (c) OpenSpug Organization. https://github.com/openspug/spug
# Copyright: (c) <spug.dev@gmail.com>
# Released under the AGPL-3.0 License.
def seconds_to_human(seconds):
text = ''
if seconds > 3600:
text = f'{int(seconds / 3600)}小时'
seconds = seconds % 3600
if seconds > 60:
text += f'{int(seconds / 60)}分钟'
seconds = seconds % 60
return f'{text}{int(seconds)}'