/
seafteam
/
seaf-archtool-core
Обзор
Документация
Войти
/
seafteam
/
seaf-archtool-core
Код
Запросы
11
Задачи
Пакеты
2
Релизы
21
Аналитика
java-back
src/backend/utils/time.mjs
30 строк
1 KB
Saveliy Zaznobin
refactor/extended-liveness-probe (
#344
)
27 ноя 2025, 11:25
27 ноя 2025, 11:25
3b43f7a
Код
Авторство
О чём код?
/* Copyright (C) 2023 Sber Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Maintainers: Saveliy Zaznobin <zaznobins@yandex.ru>, Sber Contributors: Saveliy Zaznobin <zaznobins@yandex.ru>, Sber - 2025 */ export function timeSince(timestamp) { if (!timestamp) return null; const uptimeSec = (Date.now() - timestamp) / 1000; const seconds = Math.floor(uptimeSec % 60); const minutes = Math.floor(uptimeSec / 60 % 60); const hours = Math.floor(uptimeSec / 3600); return `${hours}h ${minutes}m ${seconds}s`; }