MCPcopy Create free account
hub / github.com/ZyphrZero/z.ai2api_python / format_uptime

Function format_uptime

app/admin/stats.py:61–77  ·  view source on GitHub ↗

格式化运行时长。

(total_seconds: int)

Source from the content-addressed store, hash-verified

59
60
61def format_uptime(total_seconds: int) -> str:
62 """格式化运行时长。"""
63 total_seconds = max(0, int(total_seconds))
64 days, remainder = divmod(total_seconds, 86400)
65 hours, remainder = divmod(remainder, 3600)
66 minutes, seconds = divmod(remainder, 60)
67
68 parts = []
69 if days:
70 parts.append(f"{days}天")
71 if days or hours:
72 parts.append(f"{hours}小时")
73 if days or hours or minutes:
74 parts.append(f"{minutes}分钟")
75 parts.append(f"{seconds}秒")
76
77 return " ".join(parts)
78
79
80def get_process_uptime() -> str:

Calls

no outgoing calls