latex-ub/services/web/frontend/js/features/ide-react/connection/utils.ts
2025-05-05 12:24:05 +00:00

6 lines
199 B
TypeScript

export function secondsUntil(timestamp: number | null) {
if (!timestamp) return 0
const seconds = Math.ceil((timestamp - performance.now()) / 1000)
if (seconds > 0) return seconds
return 0
}