Spaces:
Runtime error
Runtime error
| # PATH: bot/core/uptime.py | |
| import time | |
| START_TS = time.time() | |
| def uptime_seconds() -> int: | |
| return int(time.time() - START_TS) | |
| def uptime_text() -> str: | |
| s = uptime_seconds() | |
| if s < 0: | |
| s = 0 | |
| m, s = divmod(s, 60) | |
| h, m = divmod(m, 60) | |
| d, h = divmod(h, 24) | |
| if d: | |
| return f"{d}d {h}h {m}m" | |
| if h: | |
| return f"{h}h {m}m" | |
| if m: | |
| return f"{m}m {s}s" | |
| return f"{s}s" |