/
Mihaham
/
Table-Time
Обзор
Документация
Войти
/
Mihaham
/
Table-Time
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
services/api/app/plugins/shared/timer.py
25 строк
784 B
MihahamYT
feat: full game catalog — 46 plugins, docs nav, web UI kit
14 июн 2026, 12:43
14 июн 2026, 12:43
2cd5f50
Код
Авторство
О чём код?
"""Phase timer utilities.""" import time def phase_deadline(duration_seconds: float, now: float | None = None) -> float: """Unix timestamp when phase expires.""" start = now if now is not None else time.time() return start + duration_seconds def is_phase_expired(deadline: float | None, now: float | None = None) -> bool: """True if deadline has passed.""" if deadline is None: return False current = now if now is not None else time.time() return current >= deadline def remaining_seconds(deadline: float | None, now: float | None = None) -> int: """Seconds left until deadline (0 if expired).""" if deadline is None: return 0 current = now if now is not None else time.time() return max(0, int(deadline - current))